I have a zombie game. In the barrier (Where the zombies come from) it should have a zombie spawn. So when a zombie dies or even doesn't die, it should spawn a zombie every 5 seconds. Then when they hit the wood that COVERED the barrier, it breaks after 4 hits. Help?
Follow These Steps
script.Parent:clone().Parent = ReplicatedStorage H = script.Parent.Humanoid.Health if H == 0 then wait(5) -- regen time game.ReplicatedStorage.Zombie:clone().Parent = game.Workspace --change Zombie to the name of the zombie end
I'm pretty sure this will work Then for the wood you could make it so. If it's hit by a humanoid it breaks after 5 secs Or so they wood has health and the zombies do damage. For the wood having health here are the steps
Health = script.Parent.Humanoid.Health --Finding the Health in humanoid if Health == 0 then --if health is 0 then script.Parent.Wood.CanCollide = false -- make the wood passable script.Parent.Wood.Transparancy = 1 -- make the wood invisible
function onTouched(part) local humanoid = part.Parent:FindFirstChild("Humanoid") if (humanoid ~= nil) then -- if a humanoid exists, then humanoid.Health = -25 -- damage the humanoid by 25 (4 hits kills it) end end script.Parent.Touched:connect(onTouched)
If it doesn't work change the part where it says humanoid.Health = -25 to humanoid.Health = 0 that will kill it instantly tho :p
Thanks for reading and I hope I helped plz accept my answer and comment if u have questions