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

How would I turn this into a functioning script? (Game Passes)

Asked by 10 years ago
01wait(0.5)
02local player = game.Players.LocalPlayer
03local tool = game.Lighting:FindFirstChild("Burger")
04local productId = 20580787
05 
06script.Parent.MouseButton1Click:connect(function()
07    while true do
08    local g = Game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
09    wait()
10        if g.PurchaseAccept == true then
11        local a = tool:clone()
12        a.Parent = player.Backpack
13            else
14            print"nope"
15        end
16    wait()
17    end
18 
19end)

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:

01wait(0.5)
02local player = game.Players.LocalPlayer
03local tool = game.Lighting:FindFirstChild("Burger")
04local productId = 20580787
05 
06script.Parent.MouseButton1Click:connect(function()
07g=Game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
08    repeat until g.ProductPurchaseDecision=='PurchaseGranted'
09    local a = tool:clone()
10    a.Parent = player.Backpack
11end)

Answer this question