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

How to find local player in workspace?

I'm here again, and I'm sure that somebody that is actually good at coding, unlike me, will be able to figure this out:

What I'm trying to do is find the players name in workspace. I'm attempting at making a script that increases the size of your head and I got that part down, but what I need help is locating the player in workspace. What I have is:

local char = game.Players.LocalPlayer.Name
print(char)

local wsc = game.Workspace:FindFirstChild(char)
print(wsc)

The first function thing works great and prints out the players name, but when I try to find the player in workspace it just says nil. If anyone can help me out it will be greatly appreciated

1 answer

✓ Accepted answer

Firstly, you're trying to print out an object in line 5. Also, just do this:

local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()

You can try printing the name of the character by doing:

print(char.Name)

3 comments

0

Please mark this as the correct answer if it worked :)

0

This wasn't it directly, but thanks to it I figured out the problem so I will mark it as correct. Thanks!

0

Thank you :D Also, are you professional at scripting or a... so so?

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