So I’m making a TD game where enemies use waypoints and :MoveTo
to move towards the waypoints. But theres an issue, I have an enemy that jumps periodically and ends up saving a lot of time (while it’s not supposed to) to get to the waypoint than a usual zombie. They have the same walkspeed.
code:
function mob.Move(mob, map)
local hum = mob:WaitForChild("Humanoid")
local w = map.Waypoints
for waypoint=1, #w:GetChildren() do
repeat
mob.movingTo.Value = waypoint
hum:MoveTo(w[waypoint].Position)
until hum.MoveToFinished:Wait()
end
end
comparison:
1 Like
If the issue is that a zombie jumps whilst walking to a waypoint, just disable jumping entirely? I’m not sure why the zombie jumping actually saves time, though.
I wanted to make it jump just for a little gimmick I came up with as no other tower defense game has ever done that. And yeah, it’s not supposed to save time, its only just supposed to create practical invincibility for the zombie.
So you make the zombie jump, but you noticed that makes it faster?
yeah, it counts the :MoveTo
as finished, when there was a slight bit left to move
I would try to decrease the walking speed as soon as the zombie jumps. Experiment with the value to get it back to normal speed and without it going faster.
If that doesn’t work, then you can instead change how the ability works, to not make the zombie move during a jumping state, by setting the walkspeed to 0.