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

I keep getting a error when I dont normally do?

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

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)

Again


p.Position = plr:WaitForChild('Character').Torso.Position

3 comments

0

Thx

0

This doesn't work, at all. Character is NOT a child.

0

yep didnt work.

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