Issues with moving Humanoids

Hi! I’m making a tower defense game and I’ve found a huge issue with the enemy movement systems, and I cannot figure out what they happen.

The game has waypoints, but sometimes, enemies decide to stand at one waypoint after it has reached it and stand still, and after a few seconds, start moving again. The time it stays at one point seems to depend on how long the game goes on, other than that, completely random.

This clip shows the bug working but has minor effort

This clip shows the bug working but has major effort

I’ve tried searching Google and the DevForum but I can’t find a solution to my problem.

Here is the movement code I use:

function WavesAndEnemies.MoveEnemy(Enemy,Map)
	local WaypointsFolder = Map:FindFirstChild("Waypoints")
	local Waypoints = WaypointsFolder:GetChildren()
	
	Enemy.Destroying:Connect(function()
		return
	end)
	
	for i, value in ipairs(Waypoints) do
		local Waypoint = WaypointsFolder:FindFirstChild(tostring(i))
		if Enemy and Enemy:FindFirstChild("Humanoid") then
			print("Started Moving to Waypoint "..i)
			Enemy:FindFirstChild("Humanoid"):MoveTo(Waypoint.Position)
			Enemy:FindFirstChild("Humanoid").MoveToFinished:Wait()
			print("Finished Moving to Waypoint "..i)
		else
			break
		end
	end
	Enemy:Destroy()
	return
end

Any help is greatly appreciated! Thank you!!

1 Like

Try to do this, the waypoints may not render incorrectly on the client and it will give the network owner to the server

Enemy:FindFirstChild("HumanoidRootPart"):SetNetworkOwner(nil)
1 Like

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