Want a special badge and 30 bux? Make some PolyWorld! Content and post it in the Creations forum!
Dark mode is incomplete! Please report any issues to the Discord.

NPC

Scripts Not creatable

An NPC is a non-player character returned by `NPCs:Create`.
NPCs are not Instances.


Overview

Properties

Methods


API

Properties

Slot

Slot readonly : int
Internal slot id for this NPC.

Name

Name readonly : string
Display name of the NPC, including the " [NPC]" suffix.

Position

Position : Vector3
World position of the NPC.
Writing this teleports them.

Yaw

Yaw : number
Facing direction in degrees.

Animation

Animation : int
Current animation state id.
Prefer values from `NPCs.Animations`.

Methods

Destroy

Destroy() : void
Removes this NPC from the place.

Chat

Chat(message: string) : void
Makes the NPC say a chat message.

MoveTo

MoveTo(x: number, y: number, z: number) : void
Starts walking the NPC toward a world position.

TpTo

TpTo(x: number, y: number, z: number) : void
Teleports the NPC to a world position.

SetYaw

SetYaw(degrees: number) : void
Sets the NPC facing direction in degrees.

SetAnim

SetAnim(anim: int) : void
Sets the NPC animation state.

GetX

GetX() : number deprecated
Returns the X position.
Prefer Position.
No longer recommended for use.

GetY

GetY() : number deprecated
Returns the Y position.
Prefer Position.
No longer recommended for use.

GetZ

GetZ() : number deprecated
Returns the Z position.
Prefer Position.
No longer recommended for use.

GetYaw

GetYaw() : number deprecated
Returns the yaw in degrees.
Prefer Yaw.
No longer recommended for use.