#humanoid not spawning properly
19 messages · Page 1 of 1 (latest)
function mob.Spawn(name,quantity,map)
local mobExists = ServerStorage.Mobs:FindFirstChild(name)
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
newMob.HumanoidRootPart:SetNetworkOwner(nil)
for i, object in ipairs(newMob:GetDescendants()) do
if object:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(object,"Mob")
end
end
if newMob:FindFirstChild("Animations"):FindFirstChild("hold") then
animateTower:FireAllClients(newMob,"hold")
end
newMob.Humanoid.Died:Connect(function()
if newMob.Config:FindFirstChild("deathSound") then
newMob:Destroy()
return
end
--ServerStorage.sounds.normaldeath:Clone().Parent = newMob
newMob:Destroy()
end)
coroutine.wrap(mob.move)(newMob,map)
end
else
warn("Requested mob does not exist:",name)
end
end
script btw
the mob file is in server storage
Instead of changing HumanoidRootPart.CFrame
Try using newMob:PivotTo(map.Start.CFrame)
ok ill try
@olive carbon which line tho
newMob.HumanoidRootPart.CFrame = map.Start.CFrame
nvm
is your mob a model?
** You are now Level 1! **
newMob instance