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

I keep getting a error when I dont normally do?

Asked by 9 years ago

I dont know why but it says 18:37:50.425 - Workspace.Script:4: attempt to index field 'Character' (a nil value)

script:

game.Players.PlayerAdded:connect(function(plr)
    p=game.ReplicatedStorage.TestPet:Clone()
    p.Parent = game.Workspace
    p.Position = plr.Character.Torso.Position
end)

2 answers

Log in to vote
1
Answered by 9 years ago

If spyspace12's answer doesn't work, just use a loop:

while plr.Character == nil do wait() end (put this between lines 1 and 2)

Ad
Log in to vote
-2
Answered by 9 years ago

Again


p.Position = plr:WaitForChild('Character').Torso.Position
0
Thx Operation_Meme 890 — 9y
0
This doesn't work, at all. Character is NOT a child. BlueTaslem 18071 — 9y
0
yep didnt work. Operation_Meme 890 — 9y

Answer this question