I am working on a gui that allows players to use robux to buy in game items. The script for the buttons works in studio but does not work in actual game servers, despite it being a local script. When you click the button it is supposed to do the transaction and then give the player the item but instead it takes the money and doesnt give the player the item. Here is the code
local plr = script.Parent.Parent.Parent.Parent.Parent.Parent
local link = game:GetService("MarketplaceService")
t = 0
script.Parent.MouseButton1Click:connect(function()
local marketId = 339021456
link:PromptProductPurchase(plr,marketId)
link.ProcessReceipt = function(receiptInfo)
if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == plr.userId then
if t == 0 then
t = 1
local give = game.Lighting.BuyableTools.Basketball:clone()
wait (1)
give.Parent = plr.Backpack
local give2 = give:clone()
give2.Parent = plr.StarterGear
t = 0
end
end
end
end)
