Tower Defense mobs not moving

Enemies are not moving in my friend and I’s tower defense game.

I’ve tried solving this with many things, eventually I squashed as many bugs as possible and yet they still dont move. I have no errors in the output box.

The enemies are being moved using the MoveTo() function. It is a flat path and they’re just not moving at all. I added the game because copylock is off so I was thinking someone could copy the game and check the scripts. The mobs are in a folder in serverstorage. I have two scripts in serverscriptservice, a serverscript and inside a module script.
Here are the scripts:
ServerScript

local mob = require(script.Mob)
local map = workspace.RuinsMap

for i=1, 3 do
	mob.Spawn("Prisoner", map)
	task.wait(1)
end

ModuleScript

local ServerStorage = game:GetService("ServerStorage")
local mob = {ServerStorage.Mobs:GetChildren()}
local map = workspace.RuinsMap

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

	for waypoint=1, #waypoints:GetChildren() do
		Humanoid:MoveTo(waypoints[waypoint].Position)
		Humanoid.MoveToFinished:Wait()
	end
end	
	function mob.Spawn(name, map)
			local mobExists = ServerStorage.Mobs:FindFirstChild(name)
	
	if mobExists then
		local newMob = mobExists:Clone()
		newMob.HumanoidRootPart.CFrame = map.Start.CFrame
		newMob.Parent = workspace
		
		mob.Move(newMob, map)
		print("m")
	else
		warn ("Requested mob does not exist", name)
	end
end
return mob




Here is the game:

wait nvm lemme fix that i understand ur context now

The script should work tbh seems fine to me unless your waypoints folder is empty

So it just doesnt work? I have no idea why and apparently no one does either

try putting a print function in the for loop to see if it is looping correctly

Never mind, I figured it out. Thanks for all the help, everyone.

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