As the Title Says Lmao.
There's a few methods
From a ClickDetector:
workspace.Part.ClickDetector.MouseClick:connect(function(plr) local char = plr.Character --Do whatever end)
From a Touched Event:
workspace.Part.Touched:connect(function(hit) if game.Players:GetPlayerFromCharacter(hit.Parent) then local plr = game.Players:GetPlayerFromCharacter(hit.Parent) local char = plr.Character --Do whatever end end)
Grabbing it on the player joining the game:
game.Players.PlayerAdded:connect(function(plr) repeat wait() until plr.Character local char = plr.Character --Do whatever end)
Or if you know the players name:
local char = workspace['Player1']
Here are some links to some helpful wiki articles:
https://developer.roblox.com/en-us/api-reference/class/ClickDetector
https://developer.roblox.com/en-us/api-reference/event/Players/PlayerAdded
https://developer.roblox.com/en-us/api-reference/event/BasePart/Touched
game.Players."PlayerName".Character
This points to the character of the "PlayerName"
so you can do something like this (I will be the example):
local player = game.Players.Rafii2198.Character player.Humanoid.NameDisplayDistance = 55 player.HumanoidRootPart.Position = player.HumanoidRootPart.Position + Vector3.new(0,10,0)
This will change the distance that other players will see my name to 55 (default is 100) and move me 10 studs up.
Player
has a property called Character
. Indexing this property will return the player's associated character.