local productId = 20983086
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
Game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
end)
if plr and plr:FindFirstChild"leaderstats" and plr.leaderstats:FindFirstChild"Credits" then
plr.leaderstats.Credits.Value = plr.leaderstats.Credits.Value + script.Parent.Name
end
Hey, so i have this code, were the player buy '50 credits' which i have as a developer product it opens up okay but when bought, it doesn't give the player the sed amount they bought and i don't know how to change the script to make it happen.
I don't know if you'll need it but this is the leader board, which is also working properly
function onPlayerEntered(newPlayer)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local robux = Instance.new("IntValue")
robux.Name = "Credits"
robux.Value = 0
robux.Parent = stats
stats.Parent = newPlayer
end
game.Players.ChildAdded:connect(onPlayerEntered)

1 comment
Nope, on line 2 it gets the red error line and the buy window dosent open.