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

How to find local player in workspace?

Asked by 4 years ago
Edited 4 years ago

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

Log in to vote
0
Answered by
Arj783 72
4 years ago

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)
0
Please mark this as the correct answer if it worked :) Arj783 72 — 4y
0
This wasn't it directly, but thanks to it I figured out the problem so I will mark it as correct. Thanks! Frostmaniz 4 — 4y
0
Thank you :D Also, are you professional at scripting or a... so so? Arj783 72 — 4y
Ad

Answer this question