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

How to access the player character from a Local Script?

I am trying to access the character model in game.Workspace, but I am not able to accomplish this. How may I do this task?

2 comments

0

game.Players.LocalPlayer.Character

0

workspace:WaitForChild(game.Players.LocalPlayer.Name); Kappa

1 answer

✓ Accepted answer

First you need to get the player

local player = game.Players.LocalPlayer

and then you get the character

local character = player.Character or player.CharacterAdded:Wait()

You need to use CharacterAdded:Wait() to make the script wait until the character is loaded. If you don't do it then the character variable may be nil.

2 comments

0

Aight man, thanks, I tried this many times and made adjustments but it didn't work, I'll try it this way

0

Aight thanks man, this worked.

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