Character (Property)

From Legacy Roblox Wiki
Revision as of 22:20, 2 May 2012 by >JulienDethurens
Jump to navigationJump to search
Character
Type Model
Description A model containing the parts, joints, and scripts for the corresponding Character to the Player in Workspace.
Member of Player


Description

The Character property is initially nil. But is set when the Character is spawned.

Example

This code demonstrates the use of the Character property. First, we print the character while it hasn't loaded yet, which should print nil. Then, we print it after making sure it has loaded, which should print its name.

game.Players.PlayerAdded:connect(function(player)
	print(player.Character)
	player.CharacterAdded:wait()
	print(player.Character)
end)

To get a player from a character, you can use a 'for' loop, but it is preferable to use the :GetPlayerFromCharacter() method.

See also