Make Roblox NPCs Patrol and Greet Players
Give an NPC a short walking route and add a separate greeter that turns toward nearby visitors.
Create a numbered loop
Make three anchored markers named 1, 2 and 3 around a clear area. Use a rig with a Humanoid. Sort markers numerically, move toward each with MoveTo and wait for its completion signal before advancing. Check the rig is unanchored and can walk to every marker.
Rotate a stationary greeter
Use a separate anchored model at an entrance. Search nearby player roots on the server and rotate the model toward the closest one on the horizontal plane. A short range prevents it from reacting across the lobby. A small dead zone avoids jitter if someone stands inside its pivot.
Diagnose the first stuck waypoint
Temporarily stop the patrol after one lap and watch the bot from above. Uneven ground or an obstructed route is easier to fix when you know which marker fails. For dynamic obstacles, consider a pathfinding route after the basic loop works.
Set up the walking rig on a plain test floor
Use an ordinary Humanoid rig named PatrolBot, with its root and body connected as one assembly. Keep the rig unanchored so it can move. Set three anchored marker parts in PatrolMarkers and name them 1, 2 and 3. Place each near the ground in a spot the bot can reach. The marker can be transparent and must not block the route. Arrange the first route in a triangle, which makes the order obvious in the viewport. Keep it away from other NPCs and doors until one complete patrol succeeds. Run the test from an overhead camera so you can see exactly which marker the bot is aiming at.
Make the route order deliberate
Explorer insertion order is a poor contract for a walking path. Parse the marker names as numbers and sort before walking. With numeric order, marker 10 goes after marker 2, which differs from alphabetical order. Skip objects in the folder that are not parts or have unrecognized names. Send the Humanoid toward one position and wait for its completion signal before choosing the next. If a move fails, decide whether to skip the marker, retry once, or wait until the path clears. The linked example is suited to clear ground. It is a useful diagnostic before replacing simple movement with pathfinding around obstacles.
Read the patrol's progress while debugging
Log the marker name just before MoveTo and the success flag when the attempt ends. If the movement times out, examine that segment first. Check for an anchored piece welded to the rig, a blocked doorway, a marker below the floor or a slope the character cannot climb. Move the marker to the rig's current floor height to narrow down the cause. Avoid changing walking speed and marker order during the same test. Once the simple route works reliably, remove per-waypoint logs or leave them behind a development flag. An important stuck notice is easier to find when Output isn't filled with messages for every normal loop.
Build a separate greeter for the entrance
Use an anchored display model for GreeterBot. Choose a pivot that puts the rotation at its feet or center rather than at an offset object. Scan nearby player roots at a modest interval instead of doing it every render frame. Flatten the target position so the greeter turns on the floor plane even if a player jumps. Ignore positions almost exactly on the model's pivot. Trying to compute a viewing direction from nearly identical points can cause a sudden flip. This station doesn't need a Humanoid movement loop because it only watches visitors. Keep the walking bot and the greeter as separate exercises before combining the ideas.
Test competing visitors and a blocked route
Walk two players past the greeter in opposite directions and watch which one it follows. If it switches too frequently when people pass close together, keep the current target until another visitor is noticeably closer. Then add a barrier across the patrol route and confirm that the bot handles the failed segment without stopping its script. A recorded test for the clear route and the blocked route helps you compare changes later. If pathfinding is introduced, retain the numbered markers as goals and let the path solve the route between them. The patrol sequence still has a useful job even when reaching each point becomes more sophisticated.