Hey! im making a simple tower defense game and i got a module script.
but the problem is that everytime i run this script
local ServerStorage = game:GetService("ServerStorage")
local MOB = {}
function MOB.Move(mob, map)
local humanoid = MOB:WaitForChild("Humanoid")
local waypoints = workspace.WayPoints
for waypoint=1, #waypoints:GetChildren() do
MOB.Humanoid:MoveTo(waypoints[waypoint].Position)
MOB.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.ZombieSpawn.CFrame
newMob.Parent = workspace
MOB.Move(newMob, map)
else
warn("idk")
end
end
return MOB
i get this error:
ServerScriptService.Main.MainModuleScript:4: attempt to call missing method ‘WaitForChild’ of table
function MOB.Move(mob, map)
local humanoid = MOB:WaitForChild("Humanoid")
local waypoints = workspace.WayPoints
for waypoint=1, #waypoints:GetChildren() do
MOB.Humanoid:MoveTo(waypoints[waypoint].Position)
MOB.Humanoid.MoveToFinished:Wait()
end
end
with
function MOB.Move(mob, map)
local humanoid = mob:WaitForChild("Humanoid")
local waypoints = workspace.WayPoints
for waypoint=1, #waypoints:GetChildren() do
mob.Humanoid:MoveTo(waypoints[waypoint].Position)
mob.Humanoid.MoveToFinished:Wait()
end
end