Npc
A character in your place that can walk, turn and speak, which you get from npc.find or npc.all.
Everything on the Instance page works on it too.
Events
You listen to these with :connect, which the Event page covers.
Copies a user's appearance onto the NPC, or gives the ID it copies when you pass nothing. 0 is the default appearance.
Npc:user_id(user_id: number?) -> number
example
guide:user_id(12345)
Use it fordressing a guide or shopkeeper as a real player, such as the game's creator.
user_idoptionalThe platform user ID to copy, 0 for the default appearance. Omit it to get the current ID.
Makes the NPC walk to a position or an instance, at a speed you can choose.
example
local movement = guide:move_to(door, { speed = 8 })
Use it forguides that lead players around, guards on patrol, or villagers wandering the town.
targetA position, or an instance to walk to.
optionsoptionalThe walking speed.
Build a move_to callspeed
Moves the NPC to a position or an instance at once, without walking.
Use it forputting a shopkeeper back in place, or moving an NPC between areas.
targetA position, or an instance to go to.
Turns the NPC so it faces a position or an instance.
example
guide:face(player.position)
Use it formaking a shopkeeper look at the player who is talking to them.
targetA position, or an instance to turn toward.
Shows a speech bubble with your text above the NPC.
Npc:say(text: string, options: { … }?) -> ()
example
guide:say("Follow me!", { duration = 3 })
Use it forgreetings, hints, or quest lines that NPCs say to players.
textWhat the NPC says, at most 1000 characters.
optionsoptionalHow long the Speech Bubble shows.
Build a say callduration
From Instance
id, kind, name, parent, position, rotation, size, color, transparency, visible, can_collide, anchored, velocity, physics, prompt, touched, touch_ended, touching, interacted, seat, occupied, vacated, spawn, prefab, angular_velocity, mass, collision_group, center_of_mass, gravity_scale, linear_damping, angular_damping, sleeping, display_name, clickable, clicked, billboard, audience