Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Scripting now working(Player backpack)?

Everytime i try to run my script it just errors out that the "backpack is not a valid member of player"

Here is what my code says,

game.Players.PlayerAdded:connect(function() if game.Players.raspyjessie then raspyjessi = game.Players.raspyjessie Tool = game.ReplicatedStorage.BuildingTools:clone() Tool.Parent = raspyjessi.Backpack end end)

1 comment

0

Please post the entire code in the code block.

2 answers

✓ Accepted answer

You have to wait for the backpack to be created before adding the tool to the backpack

game.Players.PlayerAdded:connect(function(player)
	if player.Name == "raspyjessi" then
		local backpack = player:WaitForChild("Backpack") --waits for the backpack to be created	
		game.ReplicatedStorage.BuildingTools:Clone().Parent = backpack
	end
end)

1 comment

0

Thank you

Yeah, post the code in code block please.

Anyway, you needed to wait for the backpack creation because it is loading so fast the minute you are in the sever it runs before your character backpack is even created.

This discussion is preserved as it was. New answers, comments, and votes are closed.