Advertisement
Kezoto

Untitled

Feb 6th, 2021
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.78 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local MinimumPlayers = 2
  3. local PFolder = game.Workspace.PFolder
  4. local CurrentGame = 1
  5. local CurrentGameName = "None"
  6. local GP = game.Workspace.Game
  7. local GP2 = game.Workspace.Game2
  8. local GP3 = game.Workspace.Game3
  9. local GP4 = game.Workspace.Game4
  10. local GP5 = game.Workspace.Game5
  11. local IT = 5
  12. local CT = 1
  13. local PlayerCount = 0
  14. local GameStarted = false
  15. local CanStart = false
  16. local GameS = game.ReplicatedStorage.Remotes.Game
  17. local WinDB = false
  18. local InterText = game.Workspace.InterText.SurfaceGui.Text
  19. Players.PlayerAdded:Connect(function(Player)
  20.  
  21. Player.CharacterAdded:Connect(function(Character)
  22. local AFK = Instance.new("BoolValue")
  23. AFK.Name = "AFK"
  24. AFK.Value = false
  25. AFK.Parent = Character
  26. local INGAME = Instance.new("BoolValue")
  27. INGAME.Name = "INGAME"
  28. INGAME.Value = false
  29. INGAME.Parent = Character
  30.  
  31.  
  32. for _, acc in ipairs(Character:GetChildren()) do
  33. if acc:IsA("Accessory") then
  34. acc:FindFirstChild("Handle").CanCollide = false
  35. end
  36. end
  37. end)
  38. Player.CharacterRemoving:Connect(function(character)
  39. if character:FindFirstChild("INGAME").Value == true then
  40. PlayerCount -= 1
  41. print("Wyszedl pan gracza! jest ich: "..PlayerCount)
  42. end
  43. end)
  44. end)
  45. while wait(0.1) do
  46. if PlayerCount == 1 and WinDB == true then
  47. print("Jest jeden gracz")
  48. local plrs = PFolder:GetChildren()
  49. for i = 1, #plrs do
  50. local plr = game.Players:GetPlayerFromCharacter(plrs[i])
  51. plr.leaderstats.Wins.Value += 1
  52. InterText.Text = plr.Name..' won the game!'
  53. plr:LoadCharacter()
  54. wait(3)
  55. end
  56. GameS.Value = false
  57. GameStarted = false
  58. print("Restart")
  59. print(GameS.Value)
  60. print(GameStarted)
  61. game.Workspace:FindFirstChild("SpadajacePanele"):Destroy()
  62. WinDB = false
  63. print("Ustawiles mozliwosc wygranej na: "..tostring(WinDB))
  64. elseif PlayerCount == 0 and WinDB == true then
  65. InterText.Text = 'No one won!'
  66. GameS.Value = false
  67. GameStarted = false
  68. print("Restart")
  69. print(GameS.Value)
  70. print(GameStarted)
  71. game.Workspace:FindFirstChild("SpadajacePanele"):Destroy()
  72. WinDB = false
  73. print("Ustawiles mozliwosc wygranej na: "..tostring(WinDB))
  74. end
  75. if CurrentGame == 1 and GameStarted == false and GameS.Value == false then
  76. wait(IT)
  77. InterText.Text = 'Intermission.'
  78. wait(CT)
  79. InterText.Text = 'Intermission..'
  80. wait(CT)
  81. InterText.Text = 'Intermission...'
  82. wait(CT)
  83. InterText.Text = 'Intermission.'
  84. wait(CT)
  85. InterText.Text = 'Intermission..'
  86. wait(CT)
  87. InterText.Text = 'Intermission...'
  88. wait(CT)
  89. for _,player in pairs(game:GetService("Players"):GetPlayers())do
  90. if player and player.Character and player.Character.AFK.Value == false then
  91. PlayerCount += 1
  92. end
  93. end
  94. if PlayerCount >= MinimumPlayers then
  95. CurrentGameName = "Hexagon Run"
  96. InterText.Text = 'Current game: '..CurrentGameName
  97. wait(1)
  98. InterText.Text = 'Intermission.'
  99. wait(CT)
  100. InterText.Text = 'Intermission..'
  101. wait(CT)
  102. InterText.Text = 'Intermission...'
  103. wait(CT)
  104. InterText.Text = 'Intermission.'
  105. wait(CT)
  106. InterText.Text = 'Intermission..'
  107. wait(CT)
  108. InterText.Text = 'Intermission...'
  109. wait(CT)
  110. print("Aktualnie jest ich: "..PlayerCount)
  111. local NowaMapka = game.Lighting:FindFirstChild("Panele"):Clone()
  112. NowaMapka.Parent = game.Workspace
  113. NowaMapka.Name = "SpadajacePanele"
  114. print("Skopiowano mapke")
  115. for _,player in pairs(game:GetService("Players"):GetPlayers())do
  116. player.Character.Parent = PFolder
  117. player.Character:FindFirstChild("INGAME").Value = true
  118. local lospos = math.random(1,5)
  119. if lospos == 1 then
  120. player.Character:MoveTo(GP.Position)
  121. elseif lospos == 2 then
  122. player.Character:MoveTo(GP2.Position)
  123. elseif lospos == 3 then
  124. player.Character:MoveTo(GP3.Position)
  125. elseif lospos == 4 then
  126. player.Character:MoveTo(GP4.Position)
  127. elseif lospos == 5 then
  128. player.Character:MoveTo(GP5.Position)
  129. end
  130. end
  131. wait(CT)
  132. InterText.Text = 'Starting in: 5'
  133. wait(CT)
  134. InterText.Text = 'Starting in: 4'
  135. wait(CT)
  136. InterText.Text = 'Starting in: 3'
  137. wait(CT)
  138. InterText.Text = 'Starting in: 2'
  139. wait(CT)
  140. InterText.Text = 'Starting in: 1'
  141. wait(CT)
  142. InterText.Text = 'Start! '
  143. wait(2)
  144. GameS.Value = true print("Wlaczono gre i panele dzialaja na: "..tostring(GameS.Value))
  145. GameStarted = true
  146. WinDB = true print(WinDB)
  147. else
  148. print(PlayerCount)
  149. InterText.Text = 'Too few players to start game!'
  150. wait(3)
  151. if GameS.Value == true then
  152. GameS.Value = false
  153. end
  154. if GameStarted == true then
  155. GameStarted = false
  156. print("Gra nie wystartowala")
  157. end
  158. if PlayerCount > 0 then
  159. PlayerCount -= 1
  160. print("Usunieto gracza! jest ich: "..PlayerCount)
  161. end
  162. end
  163. end
  164. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement