#Problem with mobs moving

61 messages · Page 1 of 1 (latest)

junior granite
#

Hello, I am trying to spawn waves of mobs that will move towards the base, stop once they're close enough and start punching it to deal damage.

But I have several problems with it.

Firstly, only a single mob spawns, it plays the walking animation but it doesn't move towards the target.

#

"Main" Script

local map = workspace.FloraFields
local base = require(script.Base)

base.Setup(map, 100)

task.wait(2)
-- base.UpdateHealth(0)

for wave=1, 10 do
    print("Wave Starting:", wave)
    
    if wave <= 2 then
        mob.Spawn("Zombie", 5, map)
        mob.Spawn("FastZombie", 1, map)
    elseif wave <= 4 then
        for i=1, 5 do
            mob.Spawn("Zombie", 25, map)
        end
    
    elseif wave <= 7 then
        for i=1, 5 do
            mob.Spawn("Zombie", 5, map)
            mob.Spawn("FastZombie", 10, map)
        end
    
    elseif wave <= 9 then
        mob.Spawn("Zombie", 5, map)
        
    elseif wave == 10 then
        mob.Spawn("Zombie", 5, map)
    end
    
    repeat
        task.wait(1)
    until #workspace.Mobs:GetChildren() == 0
    
    print("Wave Ended!")
    task.wait(1)
end```
#

Also an error I got:

ServerScriptService.Main.Mob:97: ServerScriptService.Main.Mob:37: attempt to index nil with 'Position'

#

Could anyone please help? Thanks.

final birch
#

Also the error is in the mob script

junior granite
final birch
junior granite
#

But where is it though?

junior granite
steep coral
#

post the mob module

junior granite
steep coral
#

can you upload it to pastebin

#

so I can see it better

junior granite
#

Ok

steep coral
#

I'm on mobile

junior granite
#

Shi

#

I'm also on mobile

junior granite
steep coral
junior granite
#

Ok

junior granite
steep coral
#

I feel like

#

you accidently cut out a lot of it

junior granite
#

Oh wtf

#

Yeah I did, mb

#

if mobExists then
for i = 1, quantity do
task.wait(0.5)
local newMob = mobExists:Clone()
newMob.HumanoidRootPart.CFrame = map.Start.CFrame
newMob.Parent = workspace.Mobs

        -- Set collision group
        for i, object in ipairs(newMob:GetDescendants()) do
            if object:IsA("BasePart") then
                physicsService:SetPartCollisionGroup(object, "Mob")
            end
        end
        
        -- Handle mob death
        newMob.Humanoid.Died:Connect(function()
            task.wait(1)
            newMob:Destroy()
        end)
        
        -- Move the mob towards the target
        coroutine.wrap(mob.Move)(newMob, map)
    end
    
else 
    warn("Requested mob does not exist:", name)
    
end

end

return mob

zinc stirrupBOT
#

studio** You are now Level 11! **studio

junior granite
#

Wtf

#

It keeps cutting it out

#

It keeps cutting out on mobile

junior granite
steep coral
#

I couldn't see most of the file 😭

junior granite
#

💀

junior granite
junior granite
junior granite
junior granite
inland willow
#

Have u tried

junior granite
zinc flicker
#

Have u tried

junior granite
elfin river
#

#1274863277616136304#1274863277616136304#1274863277616136304

#

help

nova vine
#

shut the fuck up

#

have you tried turning it off and on

junior granite
#

You're a scripter right? Help me plz.

junior granite
#

@worthy crag

north gorge
#

have you tried

nova vine