Climbing (Event): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>Blobbyblob Changed text that was for the wrong event (I copied the template straight from the Died_(event) page). |
>Camoy No edit summary |
||
(14 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
<onlyinclude>{{Event | |||
|name = Climbing | |||
|arguments = [[Float]] ''speed'' | |||
|arguments= [[Float | |description = Fired when a character climbs. | ||
|description= Fired when a character climbs. | |object = Humanoid | ||
|object= | }}</onlyinclude> | ||
</onlyinclude> | |||
{{clear floats}} | |||
== | == Description == | ||
The Climbing event of Humanoid gets triggered whenever a character is climbing up bricks. This can be fired when a character climbs up either a [[Truss]] or a stack of [[Part|parts]]. | |||
<pre> | The argument, ''speed'', describes how quickly the player is climbing. The value of ''speed'' is 70% of the Humanoid's [[WalkSpeed]]. | ||
function onCharacterClimbing(character, speed) | {{Example|<pre> | ||
print(character.Name, "is climbing at a speed of", speed, "studs / second.") | local function onCharacterClimbing(character, speed) | ||
print(character.Name, "is climbing at a speed of", speed, "studs / second.") | |||
end | end | ||
function onCharacterAdded(character) | local function onCharacterAdded(character) | ||
character.Humanoid.Climbing:connect( function(speed) onCharacterClimbing( character, speed ) end ) | character.Humanoid.Climbing:connect(function(speed) onCharacterClimbing(character, speed) end) | ||
end | end | ||
function onPlayerAdded(player) | local function onPlayerAdded(player) | ||
player.CharacterAdded:connect( onCharacterAdded ) | player.CharacterAdded:connect(onCharacterAdded) | ||
end | end | ||
game.Players.PlayerAdded:connect(onPlayerAdded) | game.Players.PlayerAdded:connect(onPlayerAdded) | ||
</pre> | </pre>}} | ||
[[Category:Events]] | [[Category:Events]] |
Latest revision as of 15:41, 29 January 2011
Description
The Climbing event of Humanoid gets triggered whenever a character is climbing up bricks. This can be fired when a character climbs up either a Truss or a stack of parts.
The argument, speed, describes how quickly the player is climbing. The value of speed is 70% of the Humanoid's WalkSpeed.
Example
local function onCharacterClimbing(character, speed) print(character.Name, "is climbing at a speed of", speed, "studs / second.") end local function onCharacterAdded(character) character.Humanoid.Climbing:connect(function(speed) onCharacterClimbing(character, speed) end) end local function onPlayerAdded(player) player.CharacterAdded:connect(onCharacterAdded) end game.Players.PlayerAdded:connect(onPlayerAdded)