Skip to content

NPC

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.

Inherits: Physical

Properties

  • SeatOffset: Vector3
  • Health: number
  • MaxHealth: number
  • JumpPower: number
  • WalkSpeed: number
  • UseNametag: boolean
  • NametagOffset: Vector3
  • NametagVisibleRadius: number
  • DisplayName: string
  • JumpSound: Sound
  • IsSitting: boolean
  • IsDead: boolean
  • HoldingTool: Tool
  • SittingIn: Seat
  • Character: CharacterModel
  • MoveTarget: Dynamic
  • OnGround: boolean
  • OnCeiling: boolean
  • NavDestinationDistance: number
  • NavDestinationReached: boolean
  • NavDestinationValid: boolean

Methods

Kill() → nil

Kills the NPC.

Jump() → nil

Makes the NPC jump.

Sit(seat: Seat) → nil

Makes the NPC sit on a specified seat.

Unsit(addForce: boolean) → nil

Unsits the NPC from the current seat.

EquipTool(tool: Tool) → nil

Equips the NPC with a specified tool.

DropTool() → nil

Unequips the currently equipped tool from the NPC.

LoadAppearance(userID: number) → nil

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

ClearAppearance() → nil

Clears the NPC's current appearance.

SetNavDestination(pos: Vector3) → nil

Determines the position the NPC should walk towards.

Respawn() → nil

Respawns the NPC.

TakeDamage(dmg: number) → nil

Applies damage to the NPC.

Heal(amount: number) → nil

Heals the NPC by a specified amount.

Events

  • Died: Triggered when the NPC dies.
  • Landed: Triggered when the NPC lands on the ground after a jump or fall.
  • NavFinished: Triggered when the NPC finishes navigating to a destination.