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 DynamicInstance

Events

Died

Fires when the NPC dies.

Example

game["Environment"]["NPC"].Died:Connect(function ()
    print("NPC died!")
end)

Methods

LoadAppearance → void

Parameters: userID [ int ]

Loads the specified user ID's avatar on the NPC.

Example

-- Loads the appearance of willemsteller
npc:LoadAppearance(2)

ClearAppearance → void

Clears the NPC's appearance.

Example

-- Clears the appearance of the NPC
npc:ClearAppearance()

Properties

Anchored : boolean

Determines whether the NPC is affected by physics or not.

FaceID : int

The face ID of the NPC's face.

Grounded : boolean

Returns true if the NPC is currently standing on the ground.

HeadColor : Color

Specifies the color of the NPC's head.

Health : float

Specifies the current amount of health the NPC has.

MoveTarget : Instance

Determines the instance the NPC should walk towards.

WalkSpeed : float

Determines the walkspeed of the NPC.

MaxHealth : float = 100

Specifies the maximum amount of health a NPC can have.

ShirtID : int

Specifies the shirt ID of the NPC's shirt.

PantsID : int

The pants ID of the NPC's pants.

TorsoColor : Color

Specifies the color of the NPC's torso.

LeftArmColor : Color

Specifies the color of the NPC's left arm.

RightArmColor : Color

Specifies the color of the NPC's right arm.

LeftLegColor : Color

Specifies the color of the NPC's left leg.

RightLegColor : Color

Specifies the color of the NPC's right leg.