Trouble with getting player character

So basically I am working on a very basic simulator, and I want to save the player speed but I am having trouble with getting his character for saving his speed. And I am not able to fix it.

So I am wondering how to get the player character in a normal script.

Screenshot_30

Thanks for your help!

2 Likes

player.Characte will be nil if they have not character model e.g. they have not spawned intot the game.

The character loads after the player, try putting

plr.CharacterAdded:Wait()

Before that line.

1 Like

do

character = Player.Character or Player.CharacterAdded:WAit()

I tried with Player:WaitForChild(‘Character’) same result

Character isn’t a child of player, so that wouldn’t work. Even if a character was a child of their player, the player’s name probably wouldn’t be “Character”. It would be Bob or Joe or something.

1 Like

The error says it is at line 53
where is line 53’s script line?

Character is property not a chilld of so this code will be waiting for a child named Character not waiting for the players character to spawn. Use the event ChildAdded as shown above.

1 Like

I dropped a line that is why. {30 char+}

ok now u dropped a line execute again and show meh the next error

Try what I suggested earlier, that should work.

1 Like

Thank you now it’s working I used your method. And thanks for the rest for helping me!

1 Like