lua - Attempt to index number with 'Spawner' - Stack Overflow

I got a problem where in my output it shows this:ServerScriptService.Main.Mob:28: attempt to index numb

I got a problem where in my output it shows this:

ServerScriptService.Main.Mob:28: attempt to index number with 'Spawner'

This is my code:

local ServerStorage = game:GetService("ServerStorage")
local mob = {}

function mob.Move(mob, map)
    -- Get the zombie's Humanoid
    local zombieHumanoid = script.Parent.Humanoid

    -- Create a function to check if the zombie is dead
    local function isZombieDead()
        return zombieHumanoid.Health <= 0
    end

    -- Connect the Humanoid's Died event to the function
    zombieHumanoid.Died:Connect()
        -- Destroy the zombie when it's dead
        script.Parent:Destroy()


end

function mob.Spawn(name, quantity, map)
    local mobExists  = game.ServerStorage.Mobs:FindFirstChild(name)

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

            coroutine.wrap(mob.Move)(newMob, map)
        end

    else
        warn("Requested mob does not exist:", name)
    end
end

return mob

Can someone help me??

I tried to look for the solution but I didn't find a number with Spawner

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744258697a4565523.html

相关推荐

  • lua - Attempt to index number with &#39;Spawner&#39; - Stack Overflow

    I got a problem where in my output it shows this:ServerScriptService.Main.Mob:28: attempt to index numb

    8天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信