CharacterAdded (Event): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Legend26
No edit summary
>JulienDethurens
No edit summary
Line 8: Line 8:


== Description ==
== Description ==
The ''character'' will be a model with Humanoid, all body parts, scripts, and joints. The model will be completely loaded when triggered by game.
The ''character'' will be a model with [[Humanoid]], all body parts, scripts, and joints. The model will be completely loaded when triggered by game.


{{Example|<pre>
{{Example|<code lua>
local function onRespawn(character)
local function onRespawn(character)
   --do something on respawn
   --do something on respawn
Line 20: Line 20:


game.Players.PlayerAdded:connect(onPlayerEntered)
game.Players.PlayerAdded:connect(onPlayerEntered)
</pre>}}
</code>}}


[[Category:Events]]
[[Category:Events]]

Revision as of 02:48, 24 January 2012

CharacterAdded ( Instance character )
Description Fired when a character spawns or respawns.
Member of: Player


Description

The character will be a model with Humanoid, all body parts, scripts, and joints. The model will be completely loaded when triggered by game.

Example

local function onRespawn(character)

 --do something on respawn

end

local function onPlayerEntered(newPlayer)

 newPlayer.CharacterAdded:connect(onRespawn)

end

game.Players.PlayerAdded:connect(onPlayerEntered)