RBX.lua.Humanoid (Object): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Racecar56
No edit summary
 
>Flurite
No edit summary
 
(66 intermediate revisions by 19 users not shown)
Line 1: Line 1:
This is an object that can be placed in a model, and there must be a part named 'head' and another in the same model called 'torso', this makes a 'overhead title' and a health bar by the 'head' of the model. The model name is what is diplayed on the 'overhead title'.
{{ObjectPage|name=Humanoid|
The humanoid object is used for controlling parts within the same model.  It is commonly used in creating living things in ROBLOX.  The humanoid object controls jumping, sitting, moving, and health systems.  The humanoid object also handles events such as free falling, jumping, and dying.
 
The humanoid object needs to recognize that the [[Model]] it's contained in has two [[Part]]s, named "Head", and optionally, "Torso", in order to create a healthbar (can be removed by setting the [[MaxHealth (Property)|MaxHealth property]] to 0) and name-tag GUI, with the name of the Model as the text of the name-tag.  This health bar directly correlates with the Health property in the humanoid and can be affected by either changed the Health property or by calling the [[TakeDamage]] method.  [[How_To_Make_Humanoids_Without_GUI|This GUI can be removed by making the head transparent]].
 
The humanoid object also controls the model's movement.  By calling the [[MoveTo]] method, the humanoid object will move the model to that location at the speed set by the [[WalkSpeed]] property. It will also propagate the [[Running]] event with the WalkSpeed.  It also modifies several properties including [[WalkDirection]].}}

Latest revision as of 23:33, 17 March 2012

Derived Classes
None

The humanoid object is used for controlling parts within the same model. It is commonly used in creating living things in ROBLOX. The humanoid object controls jumping, sitting, moving, and health systems. The humanoid object also handles events such as free falling, jumping, and dying.

The humanoid object needs to recognize that the Model it's contained in has two Parts, named "Head", and optionally, "Torso", in order to create a healthbar (can be removed by setting the MaxHealth property to 0) and name-tag GUI, with the name of the Model as the text of the name-tag. This health bar directly correlates with the Health property in the humanoid and can be affected by either changed the Health property or by calling the TakeDamage method. This GUI can be removed by making the head transparent.

The humanoid object also controls the model's movement. By calling the MoveTo method, the humanoid object will move the model to that location at the speed set by the WalkSpeed property. It will also propagate the Running event with the WalkSpeed. It also modifies several properties including WalkDirection.
AddCustomStatus( string custom status )
Returns nil
Description: Adds a custom status to the Humanoid. Puts a BoolValue in the Status model, with the string name and sets it to true.
Member of: Humanoid
AddStatus( enum status )
Returns nil
Description: Adds a status to the Humanoid. Puts a BoolValue in the Status model, with the status name and sets it to true.
Member of: Humanoid
GetStatuses( )
Returns Table statuses
Description: Returns a table of the Humanoid's statuses, and custom statuses.
Member of: Humanoid
HasCustomStatus( string custom status )
Returns Boolean status existence
Description: Returns boolean of the existence of the custom status.
Member of: Humanoid
HasStatus( Enum Status )
Returns Bool status existence
Description: Returns boolean of the existence of the status.
Member of: Humanoid
LoadAnimation( Animation animation )
Returns Instance
Description: This can be used to load an animation into the Humanoid as a variable.
Member of: Humanoid
MoveTo( Vector3 location, Part part )
Returns nil
Description: Causes the character of the humanoid to walk to the location.
Member of: Humanoid
RemoveCustomStatus( string custom status )
Returns nil
Description: Removes the custom status from the Status model in the Humanoid.
Member of: Humanoid
RemoveStatus( enum status )
Returns nil
Description: Removes the status from the Status model in the Humanoid.
Member of: Humanoid
SetClickToWalkEnabled( bool enabled )
Returns nil
Description: If set to false, the Player that controls the Humanoid will not be able to move by clicking on the ground.
Member of: Humanoid
TakeDamage( float amount )
Returns nil
Description: Subtracts the damage from the health of the targeted humanoid unless the character has a ForceField.
Member of: Humanoid
EquipTool( Instance tool )
Returns nil
Description: Equips a Tool.
Member of: Humanoid
UnequipTools( )
Returns nil
Description: Unequips Tools.
Member of: Humanoid
Clone( )
Returns Instance
Description: Returns a clone of the object and its children, unless its Archivable property is false. The clone will have the same properties as the original object and the same descendants (except those with an Archivable property set to false). The clone's Parent will be nil.
Member of: Instance
FindFirstChild( string name, bool recursive = false )
Returns Instance
Description: Returns the first child found with a name of name. Returns nil if no such child exists. If the optional recursive argument is true, will recursively descend the hierarchy while searching rather than only searching the immediate object.
Member of: Instance
GetChildren( )
Returns table
Description: Returns a read-only table of the object's children.
Member of: Instance
GetDebugId( int scopeLength )
Returns string
Description: Returns a coded string of the object's DebugId used internally by Roblox.
Member of: Instance
GetFullName( )
Returns String path to object
Description: Returns a string with a dot (.) character separating a path of object hierarchy excluding "game".
Member of: Instance
IsA( string className )
Returns bool
Description: Returns true if the Instance is that class or a subclass.
Member of: Instance
IsAncestorOf( Instance descendant )
Returns boolean is ancestor
Description: Returns true if the object is an ancestor of descendant.
Member of: Instance
IsDescendantOf( Instance ancestor )
Returns bool
Description: Returns true if the object is an descendant of ancestor.
Member of: Instance
Destroy( )
Returns nil
Description: Sets the Parent property to nil, locks the Parent property, disconnects all connections and calls Destroy() on all children.
Member of: Instance
ClearAllChildren( )
Returns nil
Description: Removes all descendants of the Instance, but leaves the Instance itself.
Member of: Instance
Health
Type float
Description How many "hit points" that specific character has left. Default value 100.
Member of Humanoid
MaxHealth
Property Number max health
Description The maximum available "Hit Points" a character has. Default value 100.
Member of Humanoid
LeftLeg
Property Part LeftLeg
Description The LeftLeg part for Humanoid
Member of Humanoid
RightLeg
Property Part RightLeg
Description The RightLeg part for Humanoid
Member of Humanoid
Torso
Type Part
Description Primary part for Humanoid.
Member of Humanoid
PlatformStand
Property Boolean Standing
Description Forces the humanoid to stand without moving. Released by Sit, or Jump.
Member of Humanoid
Sit
Property Boolean Seated
Description Forces the humanoid to sit.
Member of Humanoid
Jump
Property Boolean Jumping
Description When set to true, the Humanoid will be jumping.
Member of Humanoid
TargetPoint
Property Vector3
Description The Vector3 location that the Humanoid is trying to walk to.
Member of Humanoid
WalkDirection
Property Vector3 WalkDirection
Description The Vector3 direction the model/character will walk towards.
Member of Humanoid
WalkSpeed
Type int
Description How quickly a humanoid can walk. The default value is 16.
Member of Humanoid
WalkToPart
Property BasePart
Description The BasePart that the Humanoid is walking to.
Member of Humanoid
WalkToPoint
Property Vector3
Description The 3D position the Humanoid is trying to reach.
Member of Humanoid
NameOcclusion
Type NameOcclusion
Description Sets whether that player can see other people's names above their heads or not.
Member of Humanoid
Name
Type string
Description The name of the object, which is often used to identify it in the context of its parent. Note that names are not unique identifiers; multiple children of an object may share the same name. In a script where you want to access an object using a name, for example, game.Workspace["Brick"], the first object found with that name is that object. This "first object" can be found in the Explorer menu.Names are great for showing a very brief title or summary of an object.
Member of Instance
Parent
Type Instance
Description The hierarchical parent of the object. When no scripts hold references to an object, it will still be maintained as long as it's parent is set to an object which does have references to it, either by other objects or scripts. The toplevel DataModel object (the one referred to as the "game" by scripts) has no parent, but always has a reference held to it by the game engine, and exists for the duration of a session.
Member of Instance
Archivable
Type bool
Description Sets whether or not the object is saved when publishing or saving to file. Also sets whether or not the object is clonable.
Member of Instance
ClassName
Type string
Description A unique string per type of Instance. Should only be used as a unique identifier, as it does not reveal any information about nature of the type hierarchy the type is in. For this use, see IsA.
Member of Instance
RobloxLocked
Type bool
Description If true, the object and its descendants cannot be indexed or edited by a Script or LocalScript and will throw an error if it is attempted.
Member of Instance
DataCost
Type int
Description How much saving this instance with SaveInstance will add to DataComplexity
Member of Instance
Climbing ( Float speed )
Description Fired when a character climbs.
Member of: Humanoid
CustomStatusAdded ( String status )
Description Fired when a status is added to the Humanoid via the AddCustomStatus Method.
Member of: Humanoid
CustomStatusRemoved ( String status )
Description Fired when a status is removed from the Humanoid via the RemoveCustomStatus Method.
Member of: Humanoid
Died ( )
Description Fired after a Humanoid's health reaches 0.
Member of: Humanoid
FallingDown ( Bool active )
Description Fired when player is falling down.
Member of: Humanoid
FreeFalling ( Bool active )
Description Fired when player is falling.
Member of: Humanoid
GettingUp ( )
Description Fired after the Humanoid gets up from falling over.
Member of: Humanoid
HealthChanged ( float health )
Description Fired when the Humanoid's Health changes.
Member of: Humanoid
Jumping ( Bool active )
Description Fired when player is jumping.
Member of: Humanoid
PlatformStanding ( Bool isPlatformStanding )
Description Fired when the humanoid's PlatformStand property is changed.
Member of: Humanoid
Running ( Float speed )
Description Fired when player is running.
Member of: Humanoid
Seated ( Bool active )
Description Fired after a humanoid sits.
Member of: Humanoid
StatusAdded ( Status status )
Description Fired when a Status is added to the Humanoid.
Member of: Humanoid
StatusRemoved ( Status removed status )
Description Fired when an Status is removed from the Humanoid.
Member of: Humanoid
Strafing ( Bool active )
Description Fired when player is strafing.
Member of: Humanoid
AncestryChanged ( Instance child, Instance parent )
Description Fired when an ancestor of the Instance the event which is a member of child has its parent changed to parent.
Member of: Instance
Changed ( Property property )
Description Fired whenever a property of the object changes.
Member of: Instance
ChildAdded ( Instance child )
Description Fired after a child is added.
Member of: Instance
ChildRemoved ( Instance child )
Description Fired when a child is removed from the object.
Member of: Instance
DescendantAdded ( Instance descendant )
Description Fired when a descendant is added to the object.
Member of: Instance
DescendantRemoving ( Instance descendant )
Description Fired when a descendant is being removed.
Member of: Instance