Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to connect a game pass to a button?

Hello, im making a scp game and I have team chance gui, that I use to chance team with. But I have a problem, I want gamepass to connect to one of the team chance button, so you only can press it if you have the gamepass. If you have the gamepass then it will chance your team to the gamepass team. We have the gamepass ready and the button gui ready I just need a script to connect it

2 answers

If you are new to doing this sort of code there are some scripts found in the toolbox that allow you to connect your gamepass id if it is a tool like a gun.

1 comment

0

No, is a team

This works for me

local productId =  --your id here 
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function() 
 Game:GetService("MarketplaceService"):PromptPurchase(player, productId)
end)

when you're finished it should look something like this

gui TextButton localscript

(also make it a local script :3)

This discussion is preserved as it was. New answers, comments, and votes are closed.