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

Scripting now working(Player backpack)?

Asked by 9 years ago

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)

0
Please post the entire code in the code block. bbissell 346 — 9y

2 answers

Log in to vote
2
Answered by 9 years ago

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)
0
Thank you raspyjessie 117 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

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.

Answer this question