I'm trying to get a zombie spawning script but when it spawns, it dies automatically.
waittime = 60 -- 1 min function StartCountdown() waittime = 60 -- Reset the waittime everytime you start a countdown for i =1,60 do -- for 1, 60 times do -- This can be done differently, i.e repeat -code- until waittime = waittime - 1 -- Minus 1 every second wait(1) end SpawnZombie() -- Spawn a zombie after the for loop is finished StartCountdown() -- In Another min another zombie will be spawned end function SpawnZombie() local Zombie = game.Lighting.Zombie:Clone() -- Assuming its in the lighting and its name is Zombie Zombie.Parent = game.Workspace -- You can place the zombie in an appropriate spot and just parent them to workspace when spawning(Easiest way) for i,v in pairs(Zombie:GetChildren()) do -- This gets the scripts in the zombie and enables them(Keep the scripts in the Zombie Disabled so they dont brake while in the lighting) if v:IsA("Script") then v.Disabled = false end end end StartCountdown() -- Run the function to start the game/round
Looks like you didn't get all of your code in a code block, that would help. But I suspect that your zombies may be dying because you aren't calling :MakeJoints() on the zombie to make sure it's all held together.
Add in:
Zombie:MakeJoints()
Right after the line where you parent Zombie to Workspace.