im working on a noob respawn system for the noobs and here is the script
game.ReplicatedStorage.SphereShooter.OnServerEvent:Connect(function(plr,noob,Spheredmg)
wait(0.6)
noob.Humanoid.Health -= Spheredmg
for i , v in pairs(game.Workspace.Noobs:GetChildren()) do
if v:FindFirstChild("Humanoid") then
if v.Humanoid.Health == 0 then
while wait(0.1) do
if v.Name == "Noob" then
local noobpos = v.Torso.Position
plr.leaderstats.Coins.Value += 10
plr.ExpFolder.Expierience.Value += 5
local clonednoob = game.ReplicatedStorage.Noob:Clone()
clonednoob.HumanoidRootPart.Position = noobpos
clonednoob.Parent = workspace.Noobs
v:Destroy()
elseif v.Name == "ZombieNoob" then
local noobpos2 = v.HumanoidRootPart.Position
plr.leaderstats.Coins.Value += 20
plr.ExpFolder.Expierience.Value += 10
local clonednoob = game.ReplicatedStorage.ZombieNoob:Clone()
clonednoob.HumanoidRootPart.Position = noobpos2
clonednoob.Parent = workspace.Noobs
v:Destroy()
end
end
end
end
end
end)
the error is obviously somewhere under the else if statement
bc here is what it does in game it makes the regalar noobs spawn perfectly but not the zombie noobs not sure what’s going on any help is appreciated
and there arena error in output