I've been trying to make a button that only available when the player that have a certain gamepass. I am new to scripting so don't laugh D: . Here's what I have:
local id = 889632521
game.Players.PlayerAdded:connect(function(player)
if game:GetService("GamePassService"):PlayerHasPass(player, id) then
script.Parent.Visible = true
else
script.Parent.Visible = false
end
end)

5 comments
That code seems like it should work, what's the problem?
If it's a LocalScript you're running this in then you need to use PlayerOwnsAsset() instead. http://wiki.roblox.com/index.php?title=API:Class/MarketplaceService/PlayerOwnsAsset
No I'm running a script. I put that script in the button but when I test it out in the studio the button is just there like the script is not working...
Is this a GUI button or a part in the Workspace?
a GUI button