Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My Developer Product Script will not work?

Asked by 9 years ago

So I have a TextButton called 10Credits inside "Frame" which is inside "ExampleGui" which is a screen Gui inside a script (This gui comes up when you step on something) inside a model inside Workspace and inside my TextButton I have this local script

local buyButton = script.Parent
local productId = 20688603 --change to dev product id
local mps = game:GetService"MarketplaceService"

function getPlayerById(id)
for i,v in pairs(game.Players:GetPlayers()) do
if v.userId == id then
return v
end
end
end

buyButton.MouseButton1Click:connect(function()
mps:PromptProductPurchase(game.Players.LocalPlayer, productId)
end)

mps.ProcessReceipt = function(info)
local plr = getPlayerById(info.PlayerId)
if plr and plr:FindFirstChild"leaderstats" and plr.leaderstats:FindFirstChild"Credits" then
plr.leaderstats.Points.Value = plr.leaderstats.Credits.Value + 35
end
end

It is to give you 35 Credits if you buy this developer product it lets me buy it but it does not give me 35 credits it gives me 0

Answer this question