ForeverDev

Untitled

Oct 19th, 2014
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.01 KB | None | 0 0
  1. local lq = require(Workspace.LQuery)
  2. local testing = true
  3. local maps = {
  4.     map1 = {
  5.         Vector3.new(0, 0, 50),
  6.         Vector3.new(50, 0, 0),
  7.         Vector3.new(50, 0, 50),
  8.         Vector3.new(-50, 0, 0)
  9.     }
  10. }
  11.  
  12. lq("alert").setDefaultFlags({
  13.     backgroundTransparency = 0.5,
  14.     backgroundColor = Color3.new(0.2, 0.2, 0.2),
  15.     fontColor = "white",
  16.     fontSize = Enum.FontSize.Size18,
  17.     font = Enum.Font.Legacy,
  18.     pause = true
  19. })
  20.  
  21. while wait() do
  22.     if not testing then
  23.         while game.Players.NumPlayers < 3 do
  24.             lq(game.Players).alert("Atleast 3 players are needed to start!", 1)
  25.         end
  26.     end
  27.     local players = game.Players:GetPlayers()
  28.     local killer = lq(players).rand()
  29.     local map = lq(game.ServerStorage.Maps:GetChildren()).rand()
  30.     lq(players).alert("A round is about to begin, choosing killer...", 4)
  31.     lq(players).alert("The killer is " .. killer.Name .. "!", 3)
  32.     lq(players).alert("Starting round..", 3)
  33.     local activePlayers = lq(players).copy()
  34.     local spawns = lq(maps[map.Name:lower()]).copy()
  35.     local killerDead, result;
  36.     local deathConnect = function(player)
  37.         print(player.Name)
  38.         lq(activePlayers).rid(player)
  39.         if player.Name == killer.Name then
  40.             killerDead = true
  41.         end
  42.     end
  43.     lq(activePlayers).each(function(_, player)
  44.         local spawn = lq(spawns).rand()
  45.         lq(spawns).rid(spawn)
  46.         player.Character:MoveTo(spawn)
  47.         lq(player.Character.Humanoid).listen("die", function()
  48.             deathConnect(player)
  49.         end)
  50.     end)
  51.     lq(game.Players).listen("leave", function()
  52.         deathConnect(player)
  53.     end)
  54.     for timer = 60, 1, -1 do
  55.         lq(players).alert(timer, 1, {
  56.             top = true,
  57.             backgroundTransparency = 1
  58.         })
  59.         if #activePlayers < 2 or killerDead then
  60.             result = killerDead and "win" or "lose"
  61.             break
  62.         end
  63.     end
  64.     if result == "win" then
  65.         lq(players).alert("The survivors killer the murderer!", 4)
  66.     elseif result == "lose" then
  67.         lq(players).alert("The murderer killed all the survivors!", 4)
  68.     else
  69.         lq(players).alert("There was a tie!", 4)
  70.     end
  71.     lq(activePlayer).each(function(_, this)
  72.         this.Character:BreakJoints()
  73.     end)
  74. end
Advertisement
Add Comment
Please, Sign In to add comment