Advertisement
Kezoto

Untitled

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