MoveTo won't go to exact coordinate/position

Hello, this post is still related to my previous TD development. the enemies won’t go to the exact position available waypoints, If I made their walk speed slow they will go off the path. If I use MoveTo(Waypoints[Waypoint].CFrame) instead an error will pop up and they won’t move.

function Enemy.Move(Enemy, Map)
	local Humanoid = Enemy:WaitForChild("Humanoid")
	local Waypoints = Map.Waypoints
	
	for Waypoint = 1, #Waypoints:GetChildren() do
		Humanoid:MoveTo(Waypoints[Waypoint].CFrame)
		Humanoid.MoveToFinished:Wait()
	end
	
	Enemy:Destroy()
	
end
1 Like

What error? That’s important. Though it looks like you’re passing a CFrame to the MoveTo method, which takes a Vector3.

ServerScriptService.Main.Enemy:40: Unable to cast CoordinateFrame to Vector3

1 Like

Try :

Humanoid:MoveTo(Waypoints[Waypoint].CFrame.p) -- put .p at the end of .CFrame to convert cframe to vector3 position
1 Like

Apparently, It’s not a valid member of CFrame

ServerScriptService.Main.Enemy:40: P is not a valid member of CFrame

Ah, my bad, try this instead -

Humanoid:MoveTo(Waypoints[Waypoint].CFrame.Position)

Thank you, slow enemies now won’t go off the path (A bit), but uh being slow makes them freeze for a second, is there any way to fix this?

Yeah like this

I’m not sure what I’m looking at, can you give me a description of what happens when you run it?

Alright, soo, Strongs usually spawn at wave 5, a few waves later, or still at the same wave, they may freeze for a second and then move again, or they freeze and vanishes. as the post said: I’m looking for enemies to go to the exact coordinate/position like the other TD games. Yeah I think that’s all.

Do they freeze at the Waypoints exactly or in between?
Also if possible make a Video so we can understand better

Alright here, Sorry if It’s long you can skip

Darn it error while uploading

Bruh I kept getting error while uploading

Should I use pathfinding instead?

No. Pathfinding is used when your path is uncertain/long. If you use that it will take time to Compute.

Oh alright, what should I do?

I already set their HRP network owner to nil, Is this some type of lag or is it? I’ve encountered this issue for many times now

Could be due to you yielding for Every MoveTo.Finished:Wait()

Also if it’s happening in between then it’s either lag or the anim for the Movers but it shouldn’t affect the gameplay much

It will affect the gameplay tho, since it has a chance of vanishing

It Vanishes? (Charrrresssssssssssssssss)

Yea it has a chance of vanishing while freezed