GetPlayerFromCharacter (Method)

From Legacy Roblox Wiki
Jump to navigationJump to search
GetPlayerFromCharacter( Instance character )
Returns Player object which is controlling the character
Description: Gives you the player from that player's character. Useful for traps and where you only know which character is, not the player.
Member of: Players


Example
local character = game.Workspace.Player
local player = game.Players:GetPlayerFromCharacter(character)

if player then
   print("Player exists")
else
   print("Player does not exist")
end