Skip to content

NPC

Inherits Physical

NPC (non-player character) is an object similar to a Player but that can be controlled by code. Like players, it can walk and jump, and its body part colors can be customized.

Properties

SeatOffset : Vector3

The offset to the seat at which the NPC is positioned when sitting.

Health : number

The current health of the NPC.

MaxHealth : number

The maximum health of the NPC.

JumpPower : number

Determines the jump power of the NPC.

WalkSpeed : number

Determines the walking speed of the NPC.

UseNametag : boolean

Determines whether the NPC uses a nametag.

NametagOffset : Vector3

Determines the offset position of the NPC's nametag.

DisplayName : string

Determines the display name of the NPC.

JumpSound : Sound

Determines the sound played when the NPC jumps.

IsSitting : boolean

Indicates whether the NPC is currently sitting.

IsDead : boolean

Indicates whether the NPC is currently dead.

HoldingTool : Tool

Indicates the tool currently held by the NPC.

SittingIn : Seat

Indicates the seat in which the NPC is currently sitting.

Character : CharacterModel

The character model associated with the NPC.

MoveTarget : Dynamic

Determines the instance the NPC should walk towards.

OnGround : boolean

Indicates whether the NPC is currently on the ground.

OnCeiling : boolean

Indicates whether the NPC is currently on the ceiling.

Indicates the distance to the navigation destination.

Indicates whether the NPC has reached its navigation destination.

Indicates whether the navigation destination is valid.

Methods

Kill → nil

Parameters: ``

Kills the NPC.

Jump → nil

Parameters: ``

Makes the NPC jump.

Sit → nil

Parameters: seat [ Seat ]

Makes the NPC sit on a specified seat.

Unsit → nil

Parameters: addForce [ boolean? ]

Unsits the NPC from the current seat.

EquipTool → nil

Parameters: tool [ Tool ]

Equips the NPC with a specified tool.

DropTool → nil

Parameters: ``

Unequips the currently equipped tool from the NPC.

LoadAppearance → nil

Parameters: userID [ number ]

Loads the appearance of the NPC based on a user ID.

ClearAppearance → nil

Parameters: ``

Clears the NPC's current appearance.

SetNavDestination → nil

Parameters: pos [ Vector3 ]

Determines the position the NPC should walk towards.

Respawn → nil

Parameters: ``

Respawns the NPC.

TakeDamage → nil

Parameters: dmg [ number ]

Applies damage to the NPC.

Heal → nil

Parameters: amount [ number ]

Heals the NPC by a specified amount.

Events

Died

Parameters: ``

Triggered when the NPC dies.

Landed

Parameters: ``

Triggered when the NPC lands on the ground after a jump or fall.

Parameters: ``

Triggered when the NPC finishes navigating to a destination.