Advertisement
WishNite

Untitled

Dec 21st, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. function StartWaves()
  2. Status:FireAllClients("Current Wave : ".. Wave.Value)
  3.  
  4. for i,v in pairs(game.Players:GetPlayers()) do
  5. local char = v.Character
  6. if char then
  7. local pt = char:findFirstChild("PlayerTag")
  8. if pt == nil then
  9. char:MoveTo(game.Workspace.MapHolder.Map.Spawns.Spawn.Position)
  10. end
  11. end
  12. end
  13.  
  14.  
  15. for i = 1,Wave.Value * math.ceil(game.Players.NumPlayers / 2) do
  16. wait(3.5)
  17. local zombies = game.ReplicatedStorage:findFirstChild("Zombies"):GetChildren()
  18. if zombies then
  19. local chooserandom = zombies[math.random(1,#zombies)]
  20. local chosenzombie = chooserandom:clone()
  21. chosenzombie.Parent = game.Workspace:findFirstChild("Zombies")
  22. chosenzombie:makeJoints()
  23. chosenzombie:MoveTo(game.Workspace.MapHolder.Map.ZombieSpawner.Position + Vector3.new(math.random(-15,15), 5, math.random(-15,15)))
  24. local stats = chosenzombie:findFirstChild("Stats")
  25. stats.Cash.Value = stats.Cash.Value + Wave.Value
  26. stats.Damage.Value = stats.Damage.Value + Wave.Value
  27. stats.Health.Value = 100 * Wave.Value
  28. stats.Speed.Value = stats.Speed.Value + Wave.Value / 5
  29. local health = stats.Health.Value
  30. chosenzombie.Zombie.MaxHealth = health
  31. chosenzombie.Zombie.Health = health
  32. chosenzombie.Zombie.WalkSpeed = stats.Speed.Value
  33. end
  34. end
  35.  
  36. repeat wait() until #ZombieModel:GetChildren() == 0 or aliveCheck() == false
  37.  
  38. if aliveCheck() == false then
  39.  
  40. Status:FireAllClients("All players killed!")
  41. TeleportHome()
  42. else
  43. Wave.Value = Wave.Value + 1
  44. ZombieModel:ClearAllChildren()
  45. StartWaves()
  46. end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement