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
评论列表(0条)