How to make a spawner spawn different types of zombies

I’m currently making a zombie game, and I want a spawner to spawn multiple zombies, but when i go into workspace, it doesn’t spawn any zombies. All the ReplicatedStorage zombies are still in there and not in workspace.

Does anyone know how to fix this? My game won’t be very fun with only 1 type of zombie.

2 Likes

Mind sending your code so i can have a look?

2 Likes

If you’re saying that they clone, but are still in ReplicatedStorage, you are simply not parenting them to workspace. It would be helpful to see your code.

3 Likes

basically any enemy spawner script is what i typed in the spawner.

local NPC = game.ReplicatedStorage.Zombie
local spawner = script.Parent

while true do
	local Clone = NPC:Clone()
	Clone.UpperTorso.CFrame = spawner.CFrame
	Clone.Parent = workspace
	wait(3)
end

made a folder in Replicated storage with the types of zombies.
Screenshot 2022-03-05 142628

I tried modifying the script but it didn’t work. Here is what i did

local NPC = game.ReplicatedStorage.Folder.Zombies =  ("Zombie1"), ("Zombie2"), ("Zombie3"), ("Zombie4"), ("Zombie5")
local spawner = script.Parent

while true do
	local Clone = NPC:Clone()
	Clone.UpperTorso.CFrame = spawner.CFrame
	Clone.Parent = workspace
	wait(3)
end

Sorry for the late response also.

1 Like

It’s probably immediately dying because you are moving the UpperTorso out of the body, therefore breaking the neck joint, which kills the zombie. Use :PivotTo instead.

1 Like

Move the HumanoidRootPart instead of upper torso. The reason this is not working is because the humanoid root part is attached to every joint in the body. For example without a spine we cant move our arms,legs,head.

local Zombies = game.ReplicatedStorage:WaitForChild("Zombies")
local Spawner = script.Parent
local SpawnInterval = 3




while wait(SpawnInterval) do
	local Max = Zombies:GetChildren()
	if #Max == 0 then continue end
	local Zombie = Max[math.random(1, #Max)]:Clone()
	Zombie.HumanoidRootPart.CFrame = Spawner.CFrame + Vector3.new(0, 6.5, 0)
	Zombie.Parent = workspace
end