Tool not cloning into player's backpack

Hello! I’ve never had trouble with this before, but I’m trying to clone a tool into the player’s backpack if they own a gamepass.

Here is what i have so far:

game.Players.PlayerAdded:Connect(function(player)
	
	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 49983842) then
		
		local Sign = game.ReplicatedStorage:WaitForChild("Sign"):Clone()
		Sign.Parent = player.Backpack
	end
end)

For some reason, the tool is not in the player’s backpack/hotbar on join. But if I print the sign’s parent, it prints “Backpack”.

There is some more in the script, but I believe that is irrelevant to why this is happening.

I’ve looked through multiple sources and couldn’t find a fix. Any help is appreciated!

Is this a local script? Also use :WaitForChild for the backpack.

player:WaitForChild(“Backpack”)

No, it’s not a local script. It’s a normal script in ServerScriptService.

I added the :WaitForChild() (Didn’t change anything but that’s probably expected).

Ah ha!

For all of you that come by with this same problem. The fix is after the PlayerAdded event. Add a CharacterAdded event.

For example:

Old:

game.Players.PlayerAdded:Connect(function(player)

	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 49983842) then

		local Sign = game.ReplicatedStorage:WaitForChild("Sign"):Clone()
		Sign.Parent = player:WaitForChild("Backpack")
	end
end)

New:

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 49983842) then

			local Sign = game.ReplicatedStorage:WaitForChild("Sign"):Clone()
			Sign.Parent = player:WaitForChild("Backpack")
		end
	end)
end)
4 Likes

YES finally a fix, tysm for sharing :slight_smile:

1 Like