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

How do I access the Player in the workspace?

Asked by 7 years ago

How do I access the Player in the workspace?

I want to be able to access the physical player in the workspace rather than the LocalPlayer in the Players section.

0
why? abnotaddable 920 — 7y
0
why not? User#5423 17 — 7y
0
You just need to know something about the player to be able to find them e.g. name or id. User#5423 17 — 7y
0
..... so I would have to make a library of every single player on Roblox. ZetaReticuli 38 — 7y

2 answers

Log in to vote
1
Answered by
duckwit 1404 Moderation Voter
7 years ago

There is a property on Player called Character which always points to the Model in the workspace (if there is one) that belongs to the player.

Make sure you read the wiki page about .Character, though, because there are some subtleties about what Character points to when a player is in the process of re-spawning.

Note that if you ever create custom characters, you can manually set Player.Character and, if your characters are based on Humanoid, the default ROBLOX controllers will automatically be linked to it.

Ad
Log in to vote
0
Answered by
Filipalla 504 Moderation Voter
7 years ago
--Local Script
local plr = game.Players.LocalPlayer
local char = plr.Character
--char is the character

Wiki Pages

Player

Character

Answer this question