wait(0.5) local player = game.Players.LocalPlayer local tool = game.Lighting:FindFirstChild("Burger") local productId = 20580787 script.Parent.MouseButton1Click:connect(function() while true do local g = Game:GetService("MarketplaceService"):PromptProductPurchase(player, productId) wait() if g.PurchaseAccept == true then local a = tool:clone() a.Parent = player.Backpack else print"nope" end wait() end end)
How would I turn this into a functioning script, I would only want to give the tool out to the player if the purchase is accepted, because this gives it before the player click "OK" on the ROBLOX GUI which pops up.
I also have something like this:
wait(0.5) local player = game.Players.LocalPlayer local tool = game.Lighting:FindFirstChild("Burger") local productId = 20580787 script.Parent.MouseButton1Click:connect(function() g=Game:GetService("MarketplaceService"):PromptProductPurchase(player, productId) repeat until g.ProductPurchaseDecision=='PurchaseGranted' local a = tool:clone() a.Parent = player.Backpack end)