Рет қаралды 12,869
Happy new year to everyone,I look forward to seeing what 2024 has in store for us!
In todays video I show you how to make a gamepass button in Roblox Studio, this system can also be used in a variety of different ways. These are used to allow players to purchase gamepasses while still in the game. This is a great way to increase revenue throughout your game.
I really enjoy making these videos for you all so I hope you enjoy them just as much as I do!
Script 1 (Simple script, Just Prompts the gamepass)
local MarketplaceService = game:GetService("MarketplaceService")
local GamepassID = 1234567890 -- Change this ID to your Gamepass ID
script.Parent.MouseButton1Click:Connect(function()
MarketplaceService:PromptGamePassPurchase(game.Players.LocalPlayer, GamepassID)
end)
--------------------
Script 2 (Advanced, Opens a gui if the player already has the gamepass)
script.Parent.MouseButton1Click:Connect(function()
local MarketplaceService = game:GetService("MarketplaceService")
local GamepassID = 1234567890 -- Change to your Gamepass ID
local HasPass
local Gui = script.Parent.Parent.OpenGui -- Change OpenGui to whatever your gui that is going to open is called
local Player = game.Players.LocalPlayer
local success, message = pcall(function()
HasPass = MarketplaceService:UserOwnsGamePassAsync(Player.UserId, GamepassID)
end)
if HasPass then
Gui.Visible = true
wait(3) -- You can adjust how long the other frame is open if the player already has the gamepass
Gui.Visible = false
else
MarketplaceService:PromptGamePassPurchase(Player, GamepassID)
end
end)
----------------------
If you are a bit confused what to do, Feel free to create a ticket in my discord server and we can help you out!
NEW! Floppys Obby Game : www.roblox.com/games/14917960...
Floppys Simulator Game: www.roblox.com/games/13963457...
FloppyFish Merch Store: itz-floppyfish.creator-spring...
If you would like to support me even more, Super Thanks and becoming a Member is also another way to show your appreciation!
🌟 Floppys Discord Server: / discord
🌟 Floppys Roblox Game : www.roblox.com/games/11301003...
Roblox Studio Tutorial
Roblox Studio
Studio Tutorials