0 views0 copies0 likes
NPC Patrol Route with Timed Waypoints
Universal script
Copy it, then test it in your own Studio place.
Script code
16 lines ยท 0.6 KBlocal humanoid = workspace:WaitForChild("PatrolBot"):WaitForChild("Humanoid")local folder = workspace:WaitForChild("PatrolMarkers")local markers = {}for _, part in folder:GetChildren() do if part:IsA("BasePart") and tonumber(part.Name) then table.insert(markers, part) endendtable.sort(markers, function(a, b) return tonumber(a.Name) < tonumber(b.Name) end)if #markers == 0 then return endwhile humanoid.Health > 0 do for _, part in markers do if humanoid.Health <= 0 then return end humanoid:MoveTo(part.Position) humanoid.MoveToFinished:Wait() task.wait(0.5)-- โฆopen Get script for the full sourceAbout this script
Use a rig named PatrolBot with a Humanoid and a folder named PatrolMarkers containing anchored parts numbered in route order. The server sends the bot toward each marker, then pauses briefly. Humanoid MoveTo handles basic movement on clear ground, making this a good fit for a simple garden path or lobby. Test the first lap with obstacles removed before adding more advanced navigation.
Log in to leave a comment.
No comments yet
Be the first to share your thoughts!
Comments
Share what works, ask questions, or report an issue.