MoveToFinished:Wait() doesnt work

I am making a tower defense game, I made my mobs very slow (3 walkspeed) and cause of this they dont go to the end of the waypoint

here is my script to move the mobs

function mob.Move(Mob, map)
	local humanoid :Humanoid= Mob:WaitForChild("Humanoid")
	local waypoints = map.Waypoints

	for waypoint=1, #waypoints:GetChildren() do
		Mob.MovingTo.Value = waypoint
		humanoid:MoveTo(waypoints[waypoint].Position)
		humanoid.MoveToFinished:Wait()
	end
	
	Mob:Destroy()
	
	UpdateHealthBarRE:Fire(50)
end

if you guys can help me i’ll really appreciate it :slight_smile:

I hate using movetofinished wait myself.
Why don’t you to one of these.

local waypoint = waypoints[waypoint]
repeat task.wait()
humanoid:MoveTo(waypoint.Position)
until (Mob.PrimaryPart.Position - waypoint.Position).Magnitude < 5 --// ADJUST THIS NUMBER.

Make sure to adjust the number 5 as that is a distance check, i recommend 1 but also could use a distance print in the repeat loop to see how close your npc is to the point

I would set it to 1, do the above and then see how close it is before it stops moving because its ‘not close enough’

I did this for so many of my 096 npcs in the past and I can tell you distance is everything.

but when I set it to 1 the mobs are bugged, so I set to 1.5 and thats working ty :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.