Help with respawning system

I’m working on a respawning system but it doesn’t work the noobs spawn and go to the right place but the zombie noobs respawn but don’t go to the right position 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.Torso.Position
						plr.leaderstats.Coins.Value += 20
						plr.ExpFolder.Expierience.Value += 10
						local clonednoob2 = game.ReplicatedStorage.ZombieNoob:Clone()
						clonednoob2.HumanoidRootPart.Position = noobpos2
						clonednoob2.Parent = workspace.Noobs
						v:Destroy()
						end
						
						
				end
			end
		end
	end
end)

here is the the setup in workspace
Xnip2024-04-19_14-30-33

here is what it does in game

any help is appreciated tysm

nvm I have fixed it yay!!!

1 Like