ok so I have tried literally everything!! To fix this script but it wont work whatsoever.
My goal is to make this zombie model respawn after 1 second of its death.
so far this is what I have
local zombie = game.Workspace.Zombie local clone = zombie:Clone() if zombie.Humanoid.Died then zombie.Humanoid.Died:connect(function() wait(2) zombie:Destroy() clone.Parent = game.Workspace end) end
Now it works, but only 1 time. After its first death it doesnt respawn after it dies anymore. :(
Please someone help me. I just came back to coding after what seems like forever.
Put this in the actual zombie model. Died is a signal, not something you can check like you tried. You're also going to want the script to be in the zombie because you don't want to have to wire it to the died event each time you clone a new zombie. Also, if the script did end up working, it'll only connect to the died event once, after that it wouldn't work for new zombies. You would also probably get an error on your zombie variable in an online server, because you didn't use WaitForChild(). Scripts tend to load before objects (online) and error if you don't wait for those objects to load first.
local zombie = script.Parent local humanoid = zombie:WaitForChild("Humanoid") local clone = zombie:Clone() humanoid.Died:Connect(function() wait(2) clone.Parent = workspace zombie:Destroy() end)