ForeverDev

Untitled

Oct 19th, 2014
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.12 KB | None | 0 0
  1. local lq = require(Workspace.LQuery)
  2. local testing = false
  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.     while game.Players.NumPlayers < 2 do
  23.         lq(game.Players:GetPlayers()).alert("Atleast 3 players are needed to start!", 1) wait()
  24.     end
  25.     local players = game.Players:GetPlayers()
  26.     local killer = lq(players).rand()
  27.     lq(players).alert("A round is about to begin, choosing killer...", 4)
  28.     lq(players).alert("The killer is " .. killer.Name .. "!", 3)
  29.     lq(players).alert("Starting round..", 3)
  30.     local map = lq(game.ServerStorage.Maps:GetChildren()).rand():clone()
  31.     map.Parent = Workspace
  32.     map:MakeJoints()
  33.     game.ServerStorage.Knife:clone().Parent = killer.Backpack
  34.     local activePlayers = lq(players).copy()
  35.     local spawns = lq(maps[map.Name:lower()]).copy()
  36.     local killerDead, result;
  37.     local deathConnect = function(player)
  38.         print(player.Name)
  39.         lq(activePlayers).rid(player)
  40.         if player.Name == killer.Name then
  41.             killerDead = true
  42.         end
  43.     end
  44.     lq(activePlayers).each(function(_, player)
  45.         local spawn = lq(spawns).rand()
  46.         lq(spawns).rid(spawn)
  47.         player.Character:MoveTo(spawn)
  48.         player.Character.Humanoid.Died:connect(function()
  49.             deathConnect(player)
  50.         end)
  51.     end)
  52.     lq(game.Players).listen("leave", function()
  53.         deathConnect(player)
  54.     end)
  55.     for timer = 60, 1, -1 do
  56.         lq(players).alert(timer, 1, {
  57.             top = true,
  58.             backgroundTransparency = 1
  59.         })
  60.         if #activePlayers < 2 or killerDead then
  61.             result = killerDead and "win" or "lose"
  62.             break
  63.         end
  64.     end
  65.     if result == "win" then
  66.         lq(players).alert("The survivors killer the murderer!", 4)
  67.     elseif result == "lose" then
  68.         lq(players).alert("The murderer killed all the survivors!", 4)
  69.     else
  70.         lq(players).alert("There was a tie!", 4)
  71.     end
  72.     lq(activePlayers).each(function(_, this)
  73.         this.Character:BreakJoints()
  74.     end)
  75.     map:Destroy()
  76. end
Advertisement
Add Comment
Please, Sign In to add comment