Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help Me With My Humanoids Please?

Asked by 9 years ago

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?

0
Use the Died event. Look it up in the wiki EzraNehemiah_TF2 3552 — 9y
0
Thanks For That Tip, But How Do I Make It Do The Clone With The Example It Gives? MarioMarMan 0 — 9y
0
mario i already answered your question davness 376 — 9y

1 answer

Log in to vote
0
Answered by
davness 376 Moderation Voter
9 years ago

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

0
Thank You dav1000999, This Worked! MarioMarMan 0 — 9y
Ad

Answer this question