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

How do I check to see if the player has the given gamepass and give them the item?

Asked by
Avoxea 48
5 years ago
01passId = 6632153  --gravity
02passId2 = 6632270 --speed
03market = game:GetService("MarketplaceService")
04 
05game.Players.PlayerAdded:Connect(function(player)
06    function hasGravityPass(player)
07        return market:UserOwnsGamePassAsync(player,passId)
08    end
09    function hasSpeedPass(player)
10        return market:UserOwnsGamePassAsync(player,passId2)
11    end
12    player.CharacterAdded:Connect(function(char)
13        if hasGravityPass() == true then
14            grav = game.ServerStorage.GravityCoil:Clone()
15            grav.Parent = player.Backpack
View all 22 lines...

It is returning with an error of "Argument 1 missing or nil"

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago
01passId = 6632153  --gravity
02passId2 = 6632270 --speed
03market = game:GetService("MarketplaceService")
04 
05game.Players.PlayerAdded:Connect(function(player)
06    player.CharacterAdded:Connect(function()
07    if market:UserOwnsGamePassAsync(player.UserId,passId) then
08    game.ServerStorage.GravityCoil:Clone().Parent = player:WaitForChild("Backpack")
09end
10if market:UserOwnsGamePassAsync(player.UserId,passId2) then
11    game.ServerStorage["Acceleration Coil"]:Clone().Parent = player:WaitForChild("Backpack")
12     end
13   end)
14end)

this will give them the item when the character has loaded if they have the gamepass

0
okay thanks Avoxea 48 — 5y
Ad

Answer this question