How would I turn this into a functioning script? (Game Passes)
02 | local player = game.Players.LocalPlayer |
03 | local tool = game.Lighting:FindFirstChild( "Burger" ) |
04 | local productId = 20580787 |
06 | script.Parent.MouseButton 1 Click:connect( function () |
08 | local g = Game:GetService( "MarketplaceService" ):PromptProductPurchase(player, productId) |
10 | if g.PurchaseAccept = = true then |
11 | local a = tool:clone() |
12 | a.Parent = player.Backpack |
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:
02 | local player = game.Players.LocalPlayer |
03 | local tool = game.Lighting:FindFirstChild( "Burger" ) |
04 | local productId = 20580787 |
06 | script.Parent.MouseButton 1 Click:connect( function () |
07 | g = Game:GetService( "MarketplaceService" ):PromptProductPurchase(player, productId) |
08 | repeat until g.ProductPurchaseDecision = = 'PurchaseGranted' |
09 | local a = tool:clone() |
10 | a.Parent = player.Backpack |