Hey guys,
I need a bit help, I am using script which is supposed to give all players who bought gamepass an item, everything worked but once this error pop up, any ideas how to fix this ?
See script here,
local passid = 948734847 -- The ID of the gamepass goes here
local tools = {"FlyingCloud"} -- Here you just put the name(s) of the tool(s) you want given. (Tools must be put in the lighting)
local GamePassService = Game:GetService('GamePassService')
game.Players.PlayerAdded:connect(function(player)
repeat wait(0.1) until player.Backpack
repeat wait(0.1) until player.StarterGear
if GamePassService:PlayerHasPass(player, passid) then
for i = 1,#tools do
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.Backpack
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.StarterGear
end
end
end)
Thanks, ItzBlazik

3 comments
Maybe add a local for the backpack instead? (local Backpack = player:WaitForChild("Backpack"))
So then replace in the script player.Backpack with Backpack, right ? If no, sorry, I am beginner at this.
No, unless for some reason the backpack is being deleted. WaitForChild only waits for a thing to load, and be in the game.