Patrolujący NPC

Jak stworzyć patrolującego NPc, który będzie chodził pomiędzy zdefiniowanymi punktami w Roblox?

local hum = script.Parent.Humanoid
local waypoints = script.Parent.Waypoints:GetChildren()
local id = 1
hum.WalkSpeed = 10
wait(4)

hum:MoveTo(waypoints[id].Position)

hum.MoveToFinished:Connect(function()
	wait(2)
	id += 1
	if id > #waypoints then
		id = 1
	end
	hum:MoveTo(waypoints[id].Position)
end)


Scroll to Top