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

how do i use Character?

Asked by 6 years ago

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()
0
GetChildren returns every child of the instance. You want LocalPlayer http://wiki.roblox.com/index.php?title=API:Class/Players/LocalPlayer Destrings 406 — 6y
0
You're getting ALL of the players, since you're using GetChildren(). Try to use LocalPlayer. player = game.Players.LocalPlayer Jxemes 75 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

You can simply use just this:

local char = game.Players.LocalPlayer.Character
Ad

Answer this question