I know how to find a character from the player, but I can't do the opposite, help me please!
You'd need to use the GetPlayerFromCharacter method.
Here's an example..
p = game.Players:GetPlayerFromCharacter(game.Workspace.Noob)
Many ways first if we were to do it via LocalScript in StarterGui or StarterPack the script would look like this:
Player = game.Players.LocalPlayer --Sets the LocalPlayer Character = Player.Character --Sets the Character
But this is only for LocalScripts what if we would want to run it from a Touched **event via **Script?
Hierarchy: game > Workspace > Part > Script
script.Parent.Touched:connect(function(TouchedObject) --Creates Touched event function Character = TouchedObject.Parent --Sets Character if Character then --If Character is TouchedObject.Parent then proceed Player = game.Players:GetPlayerFromCharacter(Character) --Gets Player from Character end end)
There are also ways to do this via ClickDetector:
Hierarchy: game > Workspace > Part > ClickDetector > Script
Clicker = script.Parent --Defines ClickDetector Clicker.MouseClick:connect(function(Player) --MouseClick event function Char = Player.Character --Gets Character end)
Then there is of course the PlayerAdded/**CharacterAdded **events
game.Players.PlayerAdded:connect(function(Player) --PlayerAdded event Player.CharacterAdded:connect(function(Character) --Character Added event from Player print(Character.Name) end) end)