PlayerFromCharacter (Method): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>MrNicNac
Added an example of the method.
>Blocco
Added note and changed some of the code.
Line 8: Line 8:


{{clear floats}}
{{clear floats}}
<span style="font-size:16px; font-weight:bold;">Please Note: When using this method in places, it's name must be in camelCase.</span>


{{Example|You give this function a model, and it will return the player if the model is the character of that player, or nil.
{{Example|You give this function a model, and it will return the player if the model is the character of that player, or nil.
<pre>
<pre>
local Player = Game.Players:PlayerFromCharacter( Workspace.Player )
local Player = Game.Players:playerFromCharacter( Workspace.Player )
print(Player)
print(Player)
>Player
>Player

Revision as of 17:23, 27 December 2010

PlayerFromCharacter( Instance character )
Returns Player object which is controlling the character.
Description: Gives you the player from that player's character.
Member of: Players


Please Note: When using this method in places, it's name must be in camelCase.

Example
You give this function a model, and it will return the player if the model is the character of that player, or nil.
local Player = Game.Players:playerFromCharacter( Workspace.Player )
print(Player)
>Player