This script is supposed to detect if the player has the gamepass. If the player doesnt, the player can buy the pass. if the player does have it, the button says purchased instead of buy and the player cant buy the pass.
--This goes in a textbutton called 'BuyButton'
gpid = 160540391 --Gamepass ID
GPS = Game:GetService("GamePassService")
function respawned(char)
player = game.Players:FindFirstChild(char.Name)
print("Respawned")
if char:FindFirstChild("Head") ~= nil then
print("It's a Player!")
if GPS:PlayerHasPass(player, gpid) then
script.Parent.Text = "Purchased" --The textbutton text says purchased instead of buy
script.Parent.BuyButton.LocalScript = remove() --removes the local script that registers the purchase
end
end
end
Please note this script is going in several textbuttons. Please help. The script isnt working. I'm a little noobish at gui's so...

6 comments
where is the error
The dev console says nothing, but the script will not work
Hmm...
Can somebody please fix my script?
I'll try
Thx