SHARE
TWEET

Cage Catastrophe Code

lucky4291 Apr 20th, 2019 119 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Cage Catastrophe
  2.  
  3. --Script when the players exit the chamber and enter a new one. (done)
  4.  
  5. --Fix the glitch when the timer says "Choose a chamber (0)" (done)
  6.  
  7. --Instead of making this a timed minigame, make it a "round" minigame so that multiple players can win. (done)
  8. --To do this, simply create a counter before the loop and acculumate during the loop.
  9. --Make the rounds "variable" rounds so that the number of rounds depends on the number of players playing.
  10.  
  11. --Make conditions that if there are only two players left, if one of the players doesn't go in (done) - this was avoided by checking to see if there's only 1 player left in the round during the loop
  12. --a chamber and the other one does, the player in the chamber wins so that it's not a sabotage
  13. --and both players loose. There must be a winner.  
  14.  
  15. --Add pushing/hitting each other with mallets?
  16.  
  17. --Make it so that when a player leaves the game, he/she is removed from the table. (done)
  18. --When a player leaves the game, it means that he/she is no longer touching the sensor. Does that mean
  19. --he/she is automatically removed? (no) this was tested
  20.  
  21. --When the player dies, he/she is readded to the table. Fix this. (possibly fixed)
  22.  
  23. --The major glitch that was caused during this minigame was the .TouchEnded which caused the game to think that the player left the chamber even though he was still inside.
  24. --Fix this by adding a script to a different part to remove the player from the table with a .Touched instead of .TouchEnded
  25.  
  26. Minigame = script.Parent
  27. Functions = require(script.Functions)
  28.  
  29. Minigame.Volcano.Erupter.Model.Cannon.Script.Disabled = false
  30.  
  31. local Players = game:GetService("Players")
  32. for i,v in pairs (Minigame.MinigameInfo.TempContestants:GetChildren()) do
  33.     local bool = Instance.new("BoolValue", v.Value.Character)
  34.     bool.Name = "IsInChamber"
  35. end
  36.  
  37. local chamber1 = Minigame.Chamber1
  38. local chamber2 = Minigame.Chamber2
  39. local chamber3 = Minigame.Chamber3
  40.  
  41. local touching1 = {}
  42. local touching2 = {}
  43. local touching3 = {}
  44.  
  45. local sensor1 = chamber1.Sensor
  46. local sensor2 = chamber2.Sensor
  47. local sensor3 = chamber3.Sensor
  48.  
  49. local door1 = chamber1.Door
  50. local door2 = chamber2.Door
  51. local door3 = chamber3.Door
  52.  
  53. local outside1 = Minigame.Outside1
  54. local outside2 = Minigame.Outside2
  55. local outside3 = Minigame.Outside3
  56.  
  57. game.Players.PlayerRemoving:Connect(function(player)
  58.     --Check to see if the player that left is no longer in the minigame
  59.     if Minigame.MinigameInfo.TempContestants:FindFirstChild(player) == nil then
  60.         --Check to see if the player that left is still in the tables      
  61.         for i,v in pairs (touching1) do
  62.             if touching1[i] == player.Name then
  63.                 table.remove(touching1,touching1[v])
  64.                 door1.SurfaceGui.TextLabel.Text = tonumber(door1.SurfaceGui.TextLabel.Text) - 1
  65.             end
  66.         end
  67.         for i,v in pairs (touching2) do
  68.             if touching2[i] == player.Name then
  69.                 table.remove(touching2,touching2[v])
  70.                 door2.SurfaceGui.TextLabel.Text = tonumber(door2.SurfaceGui.TextLabel.Text) - 1
  71.             end
  72.         end
  73.         for i,v in pairs (touching3) do
  74.             if touching3[i] == player.Name then
  75.                 table.remove(touching3,touching3[v])
  76.                 door3.SurfaceGui.TextLabel.Text = tonumber(door3.SurfaceGui.TextLabel.Text) - 1
  77.             end
  78.         end
  79.     end
  80. end)
  81.  
  82. ---------------------------------------------------------------------------
  83. sensor1.Touched:connect(function(hit)
  84.     local humanoid = hit.Parent:FindFirstChild("Humanoid")
  85.     if humanoid then
  86.         local player = Players:GetPlayerFromCharacter(hit.Parent)
  87.         if player then
  88.             for index,name in pairs(touching1) do
  89.                 if name == player.Name then
  90.                     return;
  91.                 end
  92.             end
  93.             -- If it hasn't returned, add to touching table
  94.             if player.Character.Humanoid.Health > 0 then
  95.                 table.insert(touching1,player.Name)
  96.                 door1.SurfaceGui.TextLabel.Text = tonumber(door1.SurfaceGui.TextLabel.Text) + 1
  97.                 player.Character:FindFirstChild("IsInChamber").Value = true
  98.                 --print(player.Name.."has entered 1")
  99.             end
  100.         end
  101.     end
  102. end)
  103.  
  104. outside1.Touched:connect(function(hit)
  105.     local humanoid = hit.Parent:FindFirstChild("Humanoid")
  106.     if humanoid then
  107.         local player = Players:GetPlayerFromCharacter(hit.Parent)
  108.         if player then
  109.             for index,name in pairs(touching1) do
  110.                 if name == player.Name then
  111.                     table.remove(touching1,touching1[name])
  112.                     door1.SurfaceGui.TextLabel.Text = tonumber(door1.SurfaceGui.TextLabel.Text) - 1
  113.                     player.Character:FindFirstChild("IsInChamber").Value = false
  114.                     --print(player.Name.."has left 1")
  115.                 end
  116.             end
  117.         end
  118.     end
  119. end)
  120. ---------------------------------------------------------------------------
  121. ---------------------------------------------------------------------------
  122. sensor2.Touched:connect(function(hit)
  123.     local humanoid = hit.Parent:FindFirstChild("Humanoid")
  124.     if humanoid then
  125.         local player = Players:GetPlayerFromCharacter(hit.Parent)
  126.         if player then
  127.             for index,name in pairs(touching2) do
  128.                 if name == player.Name then
  129.                     return;
  130.                 end
  131.             end
  132.             -- If it hasn't returned, add to touching table
  133.             if player.Character.Humanoid.Health > 0 then
  134.                 table.insert(touching2,player.Name)
  135.                 door2.SurfaceGui.TextLabel.Text = tonumber(door2.SurfaceGui.TextLabel.Text) + 1
  136.                 player.Character:FindFirstChild("IsInChamber").Value = true
  137.                 --print(player.Name.."has entered 2")
  138.             end
  139.         end
  140.     end
  141. end)
  142.  
  143. outside2.Touched:connect(function(hit)
  144.     local humanoid = hit.Parent:FindFirstChild("Humanoid")
  145.     if humanoid then
  146.         local player = Players:GetPlayerFromCharacter(hit.Parent)
  147.         if player then
  148.             for index,name in pairs(touching2) do
  149.                 if name == player.Name then
  150.                     table.remove(touching2,touching2[name])
  151.                     door2.SurfaceGui.TextLabel.Text = tonumber(door2.SurfaceGui.TextLabel.Text) - 1
  152.                     player.Character:FindFirstChild("IsInChamber").Value = false
  153.                     --print(player.Name.."has left 2")
  154.                 end
  155.             end
  156.         end
  157.     end
  158. end)
  159. ---------------------------------------------------------------------------
  160. ---------------------------------------------------------------------------
  161. sensor3.Touched:connect(function(hit)
  162.     local humanoid = hit.Parent:FindFirstChild("Humanoid")
  163.     if humanoid then
  164.         local player = Players:GetPlayerFromCharacter(hit.Parent)
  165.         if player then
  166.             for index,name in pairs(touching3) do
  167.                 if name == player.Name then
  168.                     return;
  169.                 end
  170.             end
  171.             -- If it hasn't returned, add to touching table
  172.             if player.Character.Humanoid.Health > 0 then
  173.                 table.insert(touching3,player.Name)
  174.                 door3.SurfaceGui.TextLabel.Text = tonumber(door3.SurfaceGui.TextLabel.Text) + 1
  175.                 player.Character:FindFirstChild("IsInChamber").Value = true
  176.                 --print(player.Name.."has entered 3")
  177.             end
  178.         end
  179.     end
  180. end)
  181.  
  182. outside3.Touched:connect(function(hit)
  183.     local humanoid = hit.Parent:FindFirstChild("Humanoid")
  184.     if humanoid then
  185.         local player = Players:GetPlayerFromCharacter(hit.Parent)
  186.         if player then
  187.             for index,name in pairs(touching3) do
  188.                 if name == player.Name then
  189.                     table.remove(touching3,touching3[name])
  190.                     door3.SurfaceGui.TextLabel.Text = tonumber(door3.SurfaceGui.TextLabel.Text) - 1
  191.                     player.Character:FindFirstChild("IsInChamber").Value = false
  192.                     --print(player.Name.."has left 3")
  193.                 end
  194.             end
  195.         end
  196.     end
  197. end)
  198. ---------------------------------------------------------------------------
  199.  
  200. --Make the rounds so that if there are only 2-3 players playing, there is just one round.
  201. --If there are 4-6, there are two rounds
  202. --If there are 7-9, there are three rounds
  203. --If there are 10-12, there are four rounds
  204. local rounds = 0
  205. local initialRounds = 0
  206. if #Minigame.MinigameInfo.TempContestants:GetChildren() >= 2 and #Minigame.MinigameInfo.TempContestants:GetChildren() <= 3 then
  207.     rounds = 1
  208.     initialRounds = 1
  209. elseif #Minigame.MinigameInfo.TempContestants:GetChildren() >= 4 and #Minigame.MinigameInfo.TempContestants:GetChildren() <= 6 then
  210.     rounds = 2
  211.     initialRounds = 2
  212. elseif #Minigame.MinigameInfo.TempContestants:GetChildren() >= 7 and #Minigame.MinigameInfo.TempContestants:GetChildren() <= 9 then
  213.     rounds = 3
  214.     initialRounds = 3
  215. elseif #Minigame.MinigameInfo.TempContestants:GetChildren() >= 10 and #Minigame.MinigameInfo.TempContestants:GetChildren() <= 12 then
  216.     rounds = 4
  217.     initialRounds = 4
  218. end
  219.  
  220. while #Minigame.MinigameInfo.TempContestants:GetChildren() > 1 and rounds > 0 do --Might want to change this later
  221.     for i = Minigame.MinigameInfo.SelectionTime.Value, 1, -1 do
  222.         _G.Msg("Choose a chamber (" .. tostring(i) .. ")")
  223.         wait(1)
  224.     end
  225.     _G.Msg("")
  226.    
  227.     Minigame.KillScript.Disabled = false
  228.    
  229.     --close the doors
  230.     for transparency = 1, 0, -0.1 do --one second elapses
  231.         door1.Transparency = transparency
  232.         door2.Transparency = transparency
  233.         door3.Transparency = transparency
  234.         wait(0.1)
  235.     end
  236.     door1.CanCollide = true
  237.     door2.CanCollide = true
  238.     door3.CanCollide = true
  239.    
  240.     wait(1)
  241.    
  242.     if #Minigame.MinigameInfo.TempContestants:GetChildren() == 1 then
  243.         break
  244.     else
  245.         if #touching1 > #touching2 and #touching1 > #touching3 then
  246.             --create an explosion
  247.             local explosion = Instance.new("Explosion",chamber1)
  248.             explosion.DestroyJointRadiusPercent = 0
  249.             explosion.Position = chamber1.Sensor.Position
  250.             --kill all the players inside 1 and all the players not inside a chamber
  251.             --not only do the players die, but they also must be removed from the table!!!
  252.             for i = 1, #touching1 do
  253.                 local player = game.Players:FindFirstChild(touching1[i])
  254.                 if player then
  255.                     local character = player.Character
  256.                     if character then
  257.                         local humanoid = character.Humanoid
  258.                         if humanoid then
  259.                             humanoid.Health = 0
  260.                         end
  261.                     end
  262.                 end
  263.             end
  264.             touching1 = {} --nothing
  265.             door1.SurfaceGui.TextLabel.Text = 0
  266.             _G.Msg("Everyone in Chamber 1 was eliminated!")
  267.             wait(3)
  268.         elseif #touching2 > #touching1 and #touching2 > #touching3 then
  269.             --create an explosion
  270.             local explosion = Instance.new("Explosion",chamber2)
  271.             explosion.DestroyJointRadiusPercent = 0
  272.             explosion.Position = chamber2.Sensor.Position
  273.             --kill all the players inside 2 and all the players not inside a chamber
  274.             for i = 1, #touching2 do
  275.                 local player = game.Players:FindFirstChild(touching2[i])
  276.                 if player then
  277.                     local character = player.Character
  278.                     if character then
  279.                         local humanoid = character.Humanoid
  280.                         if humanoid then
  281.                             humanoid.Health = 0
  282.                         end
  283.                     end
  284.                 end
  285.             end
  286.             touching2 = {} --nothing
  287.             door2.SurfaceGui.TextLabel.Text = 0
  288.             _G.Msg("Everyone in Chamber 2 was eliminated!")
  289.             wait(3)
  290.         elseif #touching3 > #touching1 and #touching3 > #touching2 then
  291.             --create an explosion
  292.             local explosion = Instance.new("Explosion",chamber3)
  293.             explosion.DestroyJointRadiusPercent = 0
  294.             explosion.Position = chamber3.Sensor.Position
  295.             --kill all the players inside 3 and all the players not inside a chamber
  296.             for i = 1, #touching3 do
  297.                 local player = game.Players:FindFirstChild(touching3[i])
  298.                 if player then
  299.                     local character = player.Character
  300.                     if character then
  301.                         local humanoid = character.Humanoid
  302.                         if humanoid then
  303.                             humanoid.Health = 0
  304.                         end
  305.                     end
  306.                 end
  307.             end
  308.             touching3 = {} --nothing
  309.             door3.SurfaceGui.TextLabel.Text = 0
  310.             _G.Msg("Everyone in Chamber 3 was eliminated!")
  311.             wait(3)
  312.         elseif #touching1 == #touching2 and #touching2 == #touching3 and #touching1 == #touching3 then
  313.             --First check to see if there is nobody in all 3
  314.             if #touching1 == 0 and #touching2 == 0 and #touching3 == 0 then
  315.                 --do nothing. all the players will die because they're not in any chambers
  316.                 _G.Msg("Everyone was eliminated!")
  317.             else
  318.                 --Choose a random chamber to eliminate between all three
  319.                 local random = math.random(1,3)
  320.                 if random == 1 then
  321.                     --create an explosion
  322.                     local explosion = Instance.new("Explosion",chamber1)
  323.                     explosion.DestroyJointRadiusPercent = 0
  324.                     explosion.Position = chamber1.Sensor.Position
  325.                     for i = 1, #touching1 do
  326.                         local player = game.Players:FindFirstChild(touching1[i])
  327.                         if player then
  328.                             local character = player.Character
  329.                             if character then
  330.                                 local humanoid = character.Humanoid
  331.                                 if humanoid then
  332.                                     humanoid.Health = 0
  333.                                 end
  334.                             end
  335.                         end
  336.                     end
  337.                     touching1 = {} --nothing
  338.                     door1.SurfaceGui.TextLabel.Text = 0
  339.                     _G.Msg("Everyone in Chamber 1 was eliminated!")
  340.                     wait(3)
  341.                 elseif random == 2 then
  342.                     --create an explosion
  343.                     local explosion = Instance.new("Explosion",chamber2)
  344.                     explosion.DestroyJointRadiusPercent = 0
  345.                     explosion.Position = chamber2.Sensor.Position
  346.                     for i = 1, #touching2 do
  347.                         local player = game.Players:FindFirstChild(touching2[i])
  348.                         if player then
  349.                             local character = player.Character
  350.                             if character then
  351.                                 local humanoid = character.Humanoid
  352.                                 if humanoid then
  353.                                     humanoid.Health = 0
  354.                                 end
  355.                             end
  356.                         end
  357.                     end
  358.                     touching2 = {} --nothing
  359.                     door2.SurfaceGui.TextLabel.Text = 0
  360.                     _G.Msg("Everyone in Chamber 2 was eliminated!")
  361.                     wait(3)
  362.                 elseif random == 3 then
  363.                     --create an explosion
  364.                     local explosion = Instance.new("Explosion",chamber3)
  365.                     explosion.DestroyJointRadiusPercent = 0
  366.                     explosion.Position = chamber3.Sensor.Position
  367.                     for i = 1, #touching3 do
  368.                         local player = game.Players:FindFirstChild(touching3[i])
  369.                         if player then
  370.                             local character = player.Character
  371.                             if character then
  372.                                 local humanoid = character.Humanoid
  373.                                 if humanoid then
  374.                                     humanoid.Health = 0
  375.                                 end
  376.                             end
  377.                         end
  378.                     end
  379.                     touching3 = {} --nothing
  380.                     door3.SurfaceGui.TextLabel.Text = 0
  381.                     _G.Msg("Everyone in Chamber 3 was eliminated!")
  382.                     wait(3)
  383.                 end
  384.             end
  385.         elseif #touching1 == #touching2 and #touching3 < #touching1 and #touching3 < #touching2 then
  386.             --Choose a random number to eliminate between 1 and 2
  387.             local random = math.random(1,2)
  388.             if random == 1 then
  389.                 --create an explosion
  390.                 local explosion = Instance.new("Explosion",chamber1)
  391.                 explosion.DestroyJointRadiusPercent = 0
  392.                 explosion.Position = chamber1.Sensor.Position
  393.                 for i = 1, #touching1 do
  394.                     local player = game.Players:FindFirstChild(touching1[i])
  395.                     if player then
  396.                         local character = player.Character
  397.                         if character then
  398.                             local humanoid = character.Humanoid
  399.                             if humanoid then
  400.                                 humanoid.Health = 0
  401.                             end
  402.                         end
  403.                     end
  404.                 end
  405.                 touching1 = {} --nothing
  406.                 door1.SurfaceGui.TextLabel.Text = 0
  407.                 _G.Msg("Everyone in Chamber 1 was eliminated!")
  408.                 wait(3)
  409.             elseif random == 2 then
  410.                 --create an explosion
  411.                 local explosion = Instance.new("Explosion",chamber2)
  412.                 explosion.DestroyJointRadiusPercent = 0
  413.                 explosion.Position = chamber2.Sensor.Position
  414.                 for i = 1, #touching2 do
  415.                     local player = game.Players:FindFirstChild(touching2[i])
  416.                     if player then
  417.                         local character = player.Character
  418.                         if character then
  419.                             local humanoid = character.Humanoid
  420.                             if humanoid then
  421.                                 humanoid.Health = 0
  422.                             end
  423.                         end
  424.                     end
  425.                 end
  426.                 touching2 = {} --nothing
  427.                 door2.SurfaceGui.TextLabel.Text = 0
  428.                 _G.Msg("Everyone in Chamber 2 was eliminated!")
  429.                 wait(3)
  430.             end
  431.         elseif #touching2 == #touching3 and #touching1 < #touching2 and #touching1 < #touching3 then
  432.             --Choose a random number to eliminate between 2 and 3
  433.             local random = math.random(1,2)
  434.             if random == 1 then
  435.                 --create an explosion
  436.                 local explosion = Instance.new("Explosion",chamber2)
  437.                 explosion.DestroyJointRadiusPercent = 0
  438.                 explosion.Position = chamber2.Sensor.Position
  439.                 for i = 1, #touching2 do
  440.                     local player = game.Players:FindFirstChild(touching2[i])
  441.                     if player then
  442.                         local character = player.Character
  443.                         if character then
  444.                             local humanoid = character.Humanoid
  445.                             if humanoid then
  446.                                 humanoid.Health = 0
  447.                             end
  448.                         end
  449.                     end
  450.                 end
  451.                 touching2 = {} --nothing
  452.                 door2.SurfaceGui.TextLabel.Text = 0
  453.                 _G.Msg("Everyone in Chamber 2 was eliminated!")
  454.                 wait(3)
  455.             elseif random == 2 then
  456.                 --create an explosion
  457.                 local explosion = Instance.new("Explosion",chamber3)
  458.                 explosion.DestroyJointRadiusPercent = 0
  459.                 explosion.Position = chamber3.Sensor.Position
  460.                 for i = 1, #touching3 do
  461.                     local player = game.Players:FindFirstChild(touching3[i])
  462.                     if player then
  463.                         local character = player.Character
  464.                         if character then
  465.                             local humanoid = character.Humanoid
  466.                             if humanoid then
  467.                                 humanoid.Health = 0
  468.                             end
  469.                         end
  470.                     end
  471.                 end
  472.                 touching3 = {} --nothing
  473.                 door3.SurfaceGui.TextLabel.Text = 0
  474.                 _G.Msg("Everyone in Chamber 3 was eliminated!")
  475.                 wait(3)
  476.             end
  477.         elseif #touching1 == #touching3 and #touching2 < #touching1 and #touching2 < #touching3 then
  478.             --Choose a random number to eliminate between 1 and 3
  479.             local random = math.random(1,2)
  480.             if random == 1 then
  481.                 --create an explosion
  482.                 local explosion = Instance.new("Explosion",chamber1)
  483.                 explosion.DestroyJointRadiusPercent = 0
  484.                 explosion.Position = chamber1.Sensor.Position
  485.                 for i = 1, #touching1 do
  486.                     local player = game.Players:FindFirstChild(touching1[i])
  487.                     if player then
  488.                         local character = player.Character
  489.                         if character then
  490.                             local humanoid = character.Humanoid
  491.                             if humanoid then
  492.                                 humanoid.Health = 0
  493.                             end
  494.                         end
  495.                     end
  496.                 end
  497.                 touching1 = {} --nothing
  498.                 door1.SurfaceGui.TextLabel.Text = 0
  499.                 _G.Msg("Everyone in Chamber 1 was eliminated!")
  500.                 wait(3)
  501.             elseif random == 2 then
  502.                 --create an explosion
  503.                 local explosion = Instance.new("Explosion",chamber3)
  504.                 explosion.DestroyJointRadiusPercent = 0
  505.                 explosion.Position = chamber3.Sensor.Position
  506.                 for i = 1, #touching3 do
  507.                     local player = game.Players:FindFirstChild(touching3[i])
  508.                     if player then
  509.                         local character = player.Character
  510.                         if character then
  511.                             local humanoid = character.Humanoid
  512.                             if humanoid then
  513.                                 humanoid.Health = 0
  514.                             end
  515.                         end
  516.                     end
  517.                 end
  518.                 touching3 = {} --nothing
  519.                 door3.SurfaceGui.TextLabel.Text = 0
  520.                 _G.Msg("Everyone in Chamber 3 was eliminated!")
  521.                 wait(3)
  522.             end
  523.         end --end if
  524.     end --end player == 1 if
  525.  
  526.     Minigame.KillScript.Disabled = true
  527.    
  528.     for transparency = 0, 1, 0.1 do
  529.         door1.Transparency = transparency
  530.         door2.Transparency = transparency
  531.         door3.Transparency = transparency
  532.         wait(0.1)
  533.     end
  534.     door1.CanCollide = false
  535.     door2.CanCollide = false
  536.     door3.CanCollide = false
  537.     rounds = rounds - 1
  538.     print("Rounds remaining: " .. rounds .. "/" .. initialRounds)
  539. end
  540.  
  541. local EndScreen = {}
  542.  
  543. for i,v in pairs (Minigame.MinigameInfo.Contestants:GetChildren()) do
  544.     local id = v.Value.UserId
  545.     if game.Players:FindFirstChild(v.Value.Name) then
  546.         EndScreen[v.Value.Name] = {Won = false, Message = "Eliminated.", Coins = 0, playerImage = "https://www.roblox.com/bust-thumbnail/image?userId=".. id .."&width=420&height=420&format=png"}
  547.     else
  548.         EndScreen[v.Value.Name] = {Won = false, Message = "Left the game.", Coins = 0, playerImage = "https://www.roblox.com/bust-thumbnail/image?userId=".. id .."&width=420&height=420&format=png"}
  549.     end
  550. end
  551.  
  552. if #Minigame.MinigameInfo.TempContestants:GetChildren() > 1 then
  553.     for i,v in pairs (Minigame.MinigameInfo.TempContestants:GetChildren()) do
  554.         local id = v.Value.UserId
  555.         EndScreen[v.Value.Name] = {Won = true, Message = "Survived.", Coins = 10, playerImage = "https://www.roblox.com/bust-thumbnail/image?userId=".. id .."&width=420&height=420&format=png"}
  556.         v.Value.leaderstats.Coins.Value = v.Value.leaderstats.Coins.Value + 10
  557.         v.Value.leaderstats.Wins.Value = v.Value.leaderstats.Wins.Value + 1
  558.     end
  559. elseif #Minigame.MinigameInfo.TempContestants:GetChildren() == 1 then
  560.     Functions:AddWinner(Minigame.MinigameInfo.TempContestants:GetChildren()[1].Value)
  561. end
  562.  
  563. for i,v in pairs (Functions.Winners) do
  564.     if v then
  565.         if v:FindFirstChild("leaderstats") and v.leaderstats:FindFirstChild("Coins") and v.leaderstats:FindFirstChild("Wins") then
  566.             local id = v.UserId
  567.             v.leaderstats.Coins.Value = v.leaderstats.Coins.Value + 20
  568.             v.leaderstats.Wins.Value = v.leaderstats.Wins.Value + 1
  569.             EndScreen[v.Name] = {Won = true, Message = "Last one standing!", Coins = 20, playerImage = "https://www.roblox.com/bust-thumbnail/image?userId=".. id .."&width=420&height=420&format=png"}
  570.             v:LoadCharacter()
  571.         end
  572.     end
  573. end
  574.  
  575. local TempEndScreen = {}
  576.  
  577. for i,v in pairs (EndScreen) do
  578.     if v.Won then
  579.         TempEndScreen[i] = v
  580.     end
  581. end
  582.  
  583. for i,v in pairs (EndScreen) do
  584.     if v.Won == false then
  585.         TempEndScreen[i] = v
  586.     end
  587. end
  588.  
  589. EndScreen = TempEndScreen
  590. game.ReplicatedStorage.Results:FireAllClients("End Screen", EndScreen)
  591. Minigame.MinigameInfo.Finished.Value = true
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top