Hi all, I have a skip stage button on my player GUI, however I want to remove it once the player reaches the last level. Annoyingly, it allows you to use it after level 40 which then just sends you to the initial spawn point and puts your level at 41+ etc. so I don't want them to be able to use it and get nothing in return.
This is the particular part that raises the level each time it is used:
MarketplaceService = Game:GetService("MarketplaceService")
MarketplaceService.ProcessReceipt = function(receiptInfo)
players = game.Players:GetPlayers()
currency = "Stage"
done = 0
for i=1,#players do
if players[i].userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == 1083806372 and done == 0 then
done = 1
players[i].leaderstats[currency].Value = players[i].leaderstats[currency].Value + 1
players[i].Character.Humanoid.Health = 0
done = 0
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
Any help would be appreciated, thanks

2 comments
Actually, you don't need to use local. People only use local when inside functions or events. But yes, using local IS recommended.
Thanks have done that, how can I remove the button from the Gui though. I want it to disappear when they reach stage 40? Thanks