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

how do i use Character?

when i run my script that has this in it the CharacterAdded gives the message

Workspace.Script:2: attempt to index field 'CharactedAdded' (a nil value)

and without it it gives the same message for the Character

player = game.Players:GetChildren()
char = player.Character or player.CharactedAdded:wait()

2 comments

0

GetChildren returns every child of the instance. You want LocalPlayer http://wiki.roblox.com/index.php?title=API:Class/Players/LocalPlayer

0

You're getting ALL of the players, since you're using GetChildren(). Try to use LocalPlayer. player = game.Players.LocalPlayer

1 answer

You can simply use just this:

local char = game.Players.LocalPlayer.Character

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