I'm new to developer products and stuff. I made a developer product that gives the user ingame currency. The script works, but the user gets the currency before you press "buy". In the wiki it tells me to use datastores to keep track of who bought the developer product, why would that be necessary?
Script:
script.Parent.MouseButton1Click:connect(function()
local Market = game:GetService("MarketplaceService")
local id = 23747241 -- the Developer Product ID
Market:PromptProductPurchase(game.Players.LocalPlayer, id)
print("Bought")
game.Players.LocalPlayer.Clashbux.Value = game.Players.LocalPlayer.Clashbux.Value + 5000
end)

4 comments
Thanks, but I would like it if you acutally EXPLAINED what the heck is going on in this script.
I don't understand a thing.
Sorry I forgot explain when I answered
Clashbux isnt in leaderstats. LocalPlayer finds the player and in order to get into leaderstats you gotta do "game.Players.LocalPlayer.leaderstats.Clashbux"