CharacterAdded (Event): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>Camoy Example template used |
>Camoy Reformatted |
||
Line 1: | Line 1: | ||
{| | {| | ||
|<onlyinclude>{{Event| | |<onlyinclude>{{Event|name = CharacterAdded | ||
name = CharacterAdded | |||
|arguments = [[Instance]] ''character'' | |arguments = [[Instance]] ''character'' | ||
|description = Fired when a character spawns or respawns. | |description = Fired when a character spawns or respawns. | ||
Line 11: | Line 10: | ||
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| | local function onRespawn(character) | ||
<pre> | --do something on respawn | ||
function onRespawn(character) | |||
-- do something | |||
end | end | ||
function onPlayerEntered(newPlayer) | local function onPlayerEntered(newPlayer) | ||
newPlayer.CharacterAdded:connect(onRespawn) | newPlayer.CharacterAdded:connect(onRespawn) | ||
end | end | ||
game.Players.PlayerAdded:connect(onPlayerEntered) | game.Players.PlayerAdded:connect(onPlayerEntered) | ||
</pre> | </pre>}} | ||
}} |
Revision as of 13:35, 29 August 2010
|
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)