I Need Some One To Help Me, I'm Making A Zombie Game And Every Time One Of The Zombies Die I Want Them To Regen, I'm New To Coding So I Don't Know Every Thing But I Have This So Far:
local regenTime = 60 local messageTime = 2.5 local model = script.Parent local message = Instance.new("Message") if model ~= workspace then local backup = model:clone() while true do wait(60) message.Parent = game.Workspace wait(messageTime) message.Parent = nil --Copy the backup model = backup:clone() model.Parent = game.Workspace model:makeJoints() end else error("Script not put in a model! Nothing to regenerate!") end
Can Some One Edit This So It Only Regens Upon Death Of The Humanoid?
here's my edited script.
local Save = script.Parent:Clone() Save.Parent = game.ServerStorage local regenTime = 60 local messageTime = 2.5 local model = script.Parent local message = Instance.new("Message") function IsDead() -- checks if character is dead or not if model.Humanoid.Health <= 0 then return true else return false end end while true do if IsDead() then message.Parent = game.Workspace message.Text = "Regening..." wait(messageTime) message.Parent = nil - messaging wait(regenTime) -- respawn the dead character local GetBackup = Save:Clone() GetBackup.Parent = game.Workspace break -- braking the loop end wait() end model.Parent = nil -- cleaning the died zombie
After the new character spawns, the died one will be cleaned. Make sure its under the character