Humanoid
Health and locomotion controller for player characters and NPC models.
A model is treated as an NPC when it contains a Humanoid and parts named Head, Torso, Larm, Rarm, Lleg and Rleg. The Toolbox NPC, Zombie and Respawning Zombie models follow this layout. See NPCs and zombies.
Properties
Health
humanoid.Health: numberCurrent health. Reaching 0 fires Died. Setting a dead NPC's health above 0 revives it.
MaxHealth
humanoid.MaxHealth: numberRange 1 to 1000.
WalkSpeed
humanoid.WalkSpeed: numberMovement speed in studs per second. Range 0 to 64.
JumpPower
humanoid.JumpPower: numberRange 0 to 100.
WalkToPoint
humanoid.WalkToPoint: Vector3Current MoveTo target. Read only.
Parent
humanoid.Parent: Model | CharacterThe NPC model or player Character that owns the Humanoid.
Methods
MoveTo
humanoid:MoveTo(position: Vector3)Starts moving an NPC toward position. Only valid on NPC Humanoids.
humanoid:MoveTo(Vector3.new(20, 0, 0))
humanoid.MoveToFinished:Wait()TakeDamage
humanoid:TakeDamage(amount: number)Subtracts amount from Health.
Destroy
humanoid:Destroy()Removes the Humanoid from an NPC. Player Humanoids cannot be destroyed.
Events
Died
humanoid.Died()Fires when Health reaches 0.
humanoid.Died:Connect(function()
task.wait(5)
npc:Destroy()
end)MoveToFinished
humanoid.MoveToFinished(reached: boolean)Fires when a MoveTo ends. reached is false if the target was not reached.