Cannot index player models in Workspace

1 Like

If you’re trying to get the player model can’t you just use the Character property?

local char = localplayer.Character or localplayer.CharacterAdded:Wait()

And use that instead of the game.Workspace approach?

2 Likes

Thank you will try that. Hope it works. :smiley:

2 Likes

Sadly, that didn’t work…hmmm.

If you’re waiting for the character to be added, you’re doing it incorrectly. You’re just assigning the function to a variable. Remove that entire line and replace it with localplayer.CharacterAdded:Wait(). Also instead of indexing workspace; use either :WaitForChild(), :FindFirstChild(), or a dot.

Why are you trying to index their player model from the workspace anyway? Player objects have a Character property which holds a reference to the character. You already have a reference to the character so you don’t need to index them again here. Reuse the variable.

-- For example, use this to change WalkSpeed instead:
char:WaitForChild("Humanoid").WalkSpeed = 16

The or part of that bracket is useless because Player.Name will always evaluate to a truthy value so the other operand won’t be checked.

What are you using the charAdded variable for? You could just type
local char = localplayer.Character or localplayer.CharacterAdded:Wait()

thx you im still new to scripting