Advertisement
WishNite

Untitled

Dec 21st, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 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. local neededzombies = Wave.Value * math.ceil(game.Players.NumPlayers / 2)
  16. local zombieskilled = 0
  17. for i = 1,neededzombies do
  18. wait(3.5)
  19. local zombies = game.ReplicatedStorage:findFirstChild("Zombies"):GetChildren()
  20. if zombies then
  21. local chooserandom = zombies[math.random(1,#zombies)]
  22. local chosenzombie = chooserandom:clone()
  23. chosenzombie:makeJoints()
  24. chosenzombie:MoveTo(game.Workspace.MapHolder.Map.ZombieSpawner.Position + Vector3.new(math.random(-15,15), 5, math.random(-15,15)))
  25. local stats = chosenzombie:findFirstChild("Stats")
  26. stats.Cash.Value = stats.Cash.Value + Wave.Value
  27. stats.Damage.Value = stats.Damage.Value + Wave.Value
  28. stats.Health.Value = 100 * Wave.Value
  29. stats.Speed.Value = stats.Speed.Value + Wave.Value / 5
  30. local health = stats.Health.Value
  31. chosenzombie.Zombie.MaxHealth = health
  32. chosenzombie.Zombie.Health = health
  33. chosenzombie.Zombie.WalkSpeed = stats.Speed.Value
  34. chosenzombie.Zombie.Died:connect(function()
  35. zombieskilled = zombieskilled + 1
  36. end)
  37. chosenzombie.Parent = game.Workspace:findFirstChild("Zombies")
  38. end
  39. end
  40.  
  41. repeat wait() until neededzombies == zombieskilled or aliveCheck() == false
  42.  
  43. if aliveCheck() == false then
  44.  
  45. Status:FireAllClients("All players killed!")
  46. TeleportHome()
  47. else
  48. Wave.Value = Wave.Value + 1
  49. ZombieModel:ClearAllChildren()
  50. StartWaves()
  51. end
  52. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement