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

How do I fix this problem with my developer product gui?

Asked by
DrLems 5
10 years ago

The script lets you buy the product through the gui but it does not give Cash and I am stumped on why not.

Here is the script:

local buyButton = script.Parent
local productId = 19217377
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 player = script.Parent.Parent.Parent.Parent.Parent
local money = player.leaderstats.Cash
money.Value = money.Value + 500
end

1 answer

Log in to vote
1
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
10 years ago

The path could be incorrect. Replace it with game.Players.LocalPlayer like you've written before.

Ad

Answer this question