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

Issues with a currency adding Dev Product?

Asked by 6 years ago

I have a surfaceGUI that works as a store to buy 'coolstuffs' (that's the template name for now), and it doesn't want to work. When I click on the boxes the purchase prompt does not appear. the setup for my gui is the surfacegui parents textfiles and the name. the text files hold a LocalScript which is probably the issue.

The LocalScript:

local buyButton = script.Parent

local productId = 127522898

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"Cool Stuff" then

plr.leaderstats.CoolStuff.Value = plr.leaderstats.CoolStuff.Value + 100

end

end

Answer this question