Hey! I’m making a game that involves clicking buttons, then a door will open, then you can escape the building, however, I don’t know how long each round is because it depends on how long it takes the players to find and click all the buttons.
I was thinking of implementing some kind of set time, for example, 3 mins, and if they don’t complete in the 3 mins, everyone fails. However, if they do escape in the 3 mins, then an intermission would start blah blah blah.
So I’m thinking of setting a set time. But how?
Here is my main script, it’s kinda long.
SERVER SCRIPT
--// Statuses
local EndGameStatus = "All of the buttons have been activated! Get to the exit!"
local StartGameStatus = "Come on, comrades! We can escape this."
game.ReplicatedStorage.Values.ActivatedButtons:GetPropertyChangedSignal("Value"):Connect(function()
-- Setting Value Values
local buttonsLeft = 4 - game.ReplicatedStorage.Values.ActivatedButtons.Value
print(buttonsLeft)
game.ReplicatedStorage.Values.ButtonsLeft.Value = buttonsLeft
local DuringGameStatus = "There are "..4 - game.ReplicatedStorage.Values.ActivatedButtons.Value .." buttons left!"
game.ReplicatedStorage.Values.GameStatus.Value = DuringGameStatus
if buttonsLeft == 0 then
game.ReplicatedStorage.Values.GameStatus.Value = EndGameStatus
wait(5)
game.ReplicatedStorage.Values.GameStatus.Value = "30"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "29"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "28"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "27"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "25"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "24"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "23"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "22"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "21"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "20"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "19"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "18"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "17"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "16"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "15"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "14"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "13"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "12"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "11"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "10"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "9"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "8"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "7"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "6"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "5"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "4"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "3"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "2"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "1"
wait(1)
game.ReplicatedStorage.Values.GameStatus.Value = "Game Ended"
wait(0.5)
game.ReplicatedStorage.Events.EndGame:FireAllClients()
game.ReplicatedStorage.Values.InMatch.Value = false
end
end)
game.ReplicatedStorage.Events.RestartGame.OnServerEvent:Connect(function()
game.ReplicatedStorage.Values.GameStatus.Value = "Intermission"
end)
Thank you.