Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local MinimumPlayers = 2
- local PFolder = game.Workspace.PFolder
- local CurrentGame = 1
- local CurrentGameName = "None"
- local GP = game.Workspace.Game
- local GP2 = game.Workspace.Game2
- local GP3 = game.Workspace.Game3
- local GP4 = game.Workspace.Game4
- local GP5 = game.Workspace.Game5
- local IT = 5
- local CT = 1
- local PlayerCount = 0
- local GameStarted = false
- local CanStart = false
- local GameS = game.ReplicatedStorage.Remotes.Game
- local WinDB = false
- local InterText = game.Workspace.InterText.SurfaceGui.Text
- Players.PlayerAdded:Connect(function(Player)
- Player.CharacterAdded:Connect(function(Character)
- local AFK = Instance.new("BoolValue")
- AFK.Name = "AFK"
- AFK.Value = false
- AFK.Parent = Character
- local INGAME = Instance.new("BoolValue")
- INGAME.Name = "INGAME"
- INGAME.Value = false
- INGAME.Parent = Character
- for _, acc in ipairs(Character:GetChildren()) do
- if acc:IsA("Accessory") then
- acc:FindFirstChild("Handle").CanCollide = false
- end
- end
- end)
- Player.CharacterRemoving:Connect(function(character)
- if character:FindFirstChild("INGAME").Value == true then
- PlayerCount -= 1
- print("Wyszedl pan gracza! jest ich: "..PlayerCount)
- end
- end)
- end)
- while wait(0.1) do
- if PlayerCount == 1 and WinDB == true then
- print("Jest jeden gracz")
- local plrs = PFolder:GetChildren()
- for i = 1, #plrs do
- local plr = game.Players:GetPlayerFromCharacter(plrs[i])
- plr.leaderstats.Wins.Value += 1
- InterText.Text = plr.Name..' won the game!'
- plr:LoadCharacter()
- wait(3)
- end
- GameS.Value = false
- GameStarted = false
- print("Restart")
- print(GameS.Value)
- print(GameStarted)
- game.Workspace:FindFirstChild("SpadajacePanele"):Destroy()
- WinDB = false
- print("Ustawiles mozliwosc wygranej na: "..tostring(WinDB))
- elseif PlayerCount == 0 and WinDB == true then
- InterText.Text = 'No one won!'
- GameS.Value = false
- GameStarted = false
- print("Restart")
- print(GameS.Value)
- print(GameStarted)
- game.Workspace:FindFirstChild("SpadajacePanele"):Destroy()
- WinDB = false
- print("Ustawiles mozliwosc wygranej na: "..tostring(WinDB))
- end
- if CurrentGame == 1 and GameStarted == false and GameS.Value == false then
- wait(IT)
- InterText.Text = 'Intermission.'
- wait(CT)
- InterText.Text = 'Intermission..'
- wait(CT)
- InterText.Text = 'Intermission...'
- wait(CT)
- InterText.Text = 'Intermission.'
- wait(CT)
- InterText.Text = 'Intermission..'
- wait(CT)
- InterText.Text = 'Intermission...'
- wait(CT)
- for _,player in pairs(game:GetService("Players"):GetPlayers())do
- if player and player.Character and player.Character.AFK.Value == false then
- PlayerCount += 1
- end
- end
- if PlayerCount >= MinimumPlayers then
- CurrentGameName = "Hexagon Run"
- InterText.Text = 'Current game: '..CurrentGameName
- wait(1)
- InterText.Text = 'Intermission.'
- wait(CT)
- InterText.Text = 'Intermission..'
- wait(CT)
- InterText.Text = 'Intermission...'
- wait(CT)
- InterText.Text = 'Intermission.'
- wait(CT)
- InterText.Text = 'Intermission..'
- wait(CT)
- InterText.Text = 'Intermission...'
- wait(CT)
- print("Aktualnie jest ich: "..PlayerCount)
- local NowaMapka = game.Lighting:FindFirstChild("Panele"):Clone()
- NowaMapka.Parent = game.Workspace
- NowaMapka.Name = "SpadajacePanele"
- print("Skopiowano mapke")
- for _,player in pairs(game:GetService("Players"):GetPlayers())do
- player.Character.Parent = PFolder
- player.Character:FindFirstChild("INGAME").Value = true
- local lospos = math.random(1,5)
- if lospos == 1 then
- player.Character:MoveTo(GP.Position)
- elseif lospos == 2 then
- player.Character:MoveTo(GP2.Position)
- elseif lospos == 3 then
- player.Character:MoveTo(GP3.Position)
- elseif lospos == 4 then
- player.Character:MoveTo(GP4.Position)
- elseif lospos == 5 then
- player.Character:MoveTo(GP5.Position)
- end
- end
- wait(CT)
- InterText.Text = 'Starting in: 5'
- wait(CT)
- InterText.Text = 'Starting in: 4'
- wait(CT)
- InterText.Text = 'Starting in: 3'
- wait(CT)
- InterText.Text = 'Starting in: 2'
- wait(CT)
- InterText.Text = 'Starting in: 1'
- wait(CT)
- InterText.Text = 'Start! '
- wait(2)
- GameS.Value = true print("Wlaczono gre i panele dzialaja na: "..tostring(GameS.Value))
- GameStarted = true
- WinDB = true print(WinDB)
- else
- print(PlayerCount)
- InterText.Text = 'Too few players to start game!'
- wait(3)
- if GameS.Value == true then
- GameS.Value = false
- end
- if GameStarted == true then
- GameStarted = false
- print("Gra nie wystartowala")
- end
- if PlayerCount > 0 then
- PlayerCount -= 1
- print("Usunieto gracza! jest ich: "..PlayerCount)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement