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

How do I find the name of the Player?

I am trying to find a player (from workspace), and:

  1. I already made a string value in players
  2. do I use a local script or a normal script

Thanks for the Help!

2 answers

✓ Accepted answer

You can use :FindFirstChild() from either a Local Script or a regular Script to get the character with the corresponding name, but you can only make changes to them on the server with a regular Script (without going through filtering enabled). For example, from a regular Script,

--If you want the character from Workspace
local Char = game.Workspace:FindFirstChild(PlayerName)
Char:Destroy()

--If you want the player from Players
local Player = game.Players:FindFirstChild(PlayerName)
Player:Kick()

3 comments

0

I actually need the player name from the "Players" file

0

Then you would do the same thing, except instead of game.Workspace:FindFirstChild(PlayerName), do game.Players:FindFirstChild(PlayerName). You can then do something like Player:Kick()

0

what if I wanted to find a one player out of two players?

i'm not sure if you mean you need a script or what kind of script but im just going by what i think you mean it needs a local script

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