Npc type
A player-shaped entity every client from 1.8 sees, from world.npc; it can walk, talk, hold items, wear armour and ride.
Functions 10
npc:look_at(pos: Vec3)Where it stands; live, so setting it moves the NPC. A riding NPC reads the seat's position. Partial writes preserve other angles; nil after removal. Bodies have no roll. Turns head and body toward a point.
npc:swing()Plays the arm swing animation.
npc:hold(item: (ItemSpec | false)?)Puts an item in the main hand; nil or false empties it. An error on an unknown item.
npc:say(text: Text, color: Ink?)Sends a chat line "<name> ..." to the room, or just the words for an NPC with no name.
npc:walk(opts: { path: { Vec3 }, speed: number?, loop: boolean? }?)Walks the points by itself, facing where it goes; nil stops it.
npc:wear(pieces: Worn)Puts armour on it, head first; each piece is an item.
npc:ride(thing: MountTarget, opts: { seat: number? }?) → booleanSits in a seat as player:ride does, and never drives; false when somebody sits there.
npc:dismount()Gets off where it sits; set at after it to put it somewhere else.
npc:move(at: Vec3, rotation: BodyRotation?)Removes the NPC. Sets position and optional rotation together.
npc:destroy()Fields 5
npc.id: numberThe entity id, what players.on_click reports in hit.entity_id.
npc.name: stringWhether it is still present. Read-only. "" for one made with no name, which has no name tag.
npc.walking: booleanTrue while it walks a path, until the last point; never false with loop.
npc.pose: NpcPoseHow the body is held; live.
npc.riding: booleanWhether it sits in a seat; live.