Advertisement
AvidMalignus

Zombie spawning script (Local) (Lua 5.1)

May 12th, 2015
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.52 KB | None | 0 0
  1. --Curtis Joseph Winkler (AvidMalignus)
  2. --Script that spawns a zombie off a player's corpse after a short period of time.
  3. --5/12/2015 @ 11:02 AM
  4. ----------------------------------------------------------------------------------------------------------------------------------
  5. local Workspace = game:GetService('Workspace')
  6. local Players = game:GetService('Players')
  7. ---
  8. local InsertService = game:GetService('InsertService')
  9. local Zombie = 0
  10. ---
  11. local Player = Players.LocalPlayer
  12. local Character = Player.Character or Character.CharacterAdded
  13. local Humanoid = Character:WaitForChild("Humanoid")
  14. ----------------------------------------------------------------------------------------------------------------------------------
  15. function WaitForChild(start,...)
  16.         if not start:IsA("Instance") then return end
  17.         local currentObj = start
  18.         for _,v in pairs{...} do
  19.                 if type(v) == "string" then
  20.                         currentObj = currentObj:WaitForChild(v)
  21.                 end
  22.         end
  23.         return currentObj
  24. end
  25. ----------------------------------------------------------------------------------------------------------------------------------
  26. local function SpawnZombie()
  27. if Humanoid.Health and Humanoid.MaxHealth == 0 then
  28. local ZombieModel = InsertService:Insert(Zombie):GetChildren([1])
  29. ZombieModel.Parent = Workspace
  30. local ZHRP = WaitForChild(ZombieModel,"Character","HumanoidRootPart")
  31. ZHRP.CFrame = CFrame.new(Vector3.new(WaitForChild(Character,"HumanoidRootPart","CFrame")
  32.    end
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement