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

Game Pass gear giver not giving an error even though not functional?

Asked by
R_alatch 394 Moderation Voter
5 years ago

Not getting an error, but whenever I join I have the HyperBike but not the Jetpack. I am not getting an error, it just flat out doesn't work.

local bikeid = 5473500
local jetpackid = 5473721

game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased)
    if purchased and ido == bikeid then
        local gear = game.ServerStorage:WaitForChild("HyperBike")
        gear:Clone().Parent = plr.Backpack
    elseif purchased and ido == jetpackid then
        local gear = game.ServerStorage:WaitForChild("Jetpack")
        gear:Clone().Parent = plr.Backpack
    end
end)

game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:connect(function(char)
        if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.Players[char.Name].UserId, bikeid) then
            local gear = game.ServerStorage:WaitForChild("HyperBike")
            gear:Clone().Parent = plr.Backpack
        elseif game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.Players[char.Name].UserId, jetpackid) then
            local gear = game.ServerStorage:WaitForChild("Jetpack")
            gear:Clone().Parent = plr.Backpack
        end
    end)
end)
0
why not make 2 individual if statements. DinozCreates 1070 — 5y

Answer this question