james_e3
|
  |
| Joined: 23 Nov 2012 |
| Total Posts: 43 |
|
|
| 08 May 2017 05:43 PM |
| How would I code a respawning zombie? |
|
|
| Report Abuse |
|
|
james_e3
|
  |
| Joined: 23 Nov 2012 |
| Total Posts: 43 |
|
| |
|
james_e3
|
  |
| Joined: 23 Nov 2012 |
| Total Posts: 43 |
|
| |
|
james_e3
|
  |
| Joined: 23 Nov 2012 |
| Total Posts: 43 |
|
| |
|
iZug
|
  |
| Joined: 22 Mar 2012 |
| Total Posts: 2417 |
|
|
| 08 May 2017 06:12 PM |
Place this script into your zombie
local model = script.Parent local backup = model:clone()
local humanoid = model.Humanoid
function onDied() wait(5)
backup.Parent = workspace backup:makeJoints()
model:remove() end
humanoid.Died:connect(onDied)
function waitForChild(parent, childName) local child = parent:findFirstChild(childName) if child then return child end while true do child = parent.ChildAdded:wait() if child.Name==childName then return child end end end
-- declarations
local Figure = script.Parent local Head = waitForChild(Figure, "Head") local Humanoid = waitForChild(Figure, "Humanoid")
-- regeneration while true do local s = wait(1) local health = Humanoid.Health if health > 0 and health < Humanoid.MaxHealth then health = health + 0.01 * s * Humanoid.MaxHealth if health * 1.05 < Humanoid.MaxHealth then Humanoid.Health = health else Humanoid.Health = Humanoid.MaxHealth end end end
אם זה פוגע בך, אל תדבר איתי | ◕‿◕ |
|
|
| Report Abuse |
|
|