Hello, I made a GUI button that is suppose to advance your stage by 1 if you buy a developer product. It is not working. The lase "end" is erroring. Also, how could I make it where the max stage is 5. (There are only 5 stages)
Thank you in advance.
Script:
local MarketplaceService = Game:GetService("MarketplaceService")
local buyButton = script.Parent
local productId = 20392847
local player = script.Parent.Parent.Parent.Parent -- Parent as the player.
local pointsToAward = PointsService:GetAwardablePoints()
local universeBalance = PointsService:GetGamePointBalance(player.userId)
buyButton.MouseButton1Click:connect(function()
MarketplaceService:PromptProductPurchase(player, productId)
game.Players.LocalPlayer.leaderstats.Stage.Value = game.Players.LocalPlayer.leaderstats.Stage.Value + 1
end
end) |