Hello!
I would like to know how I can make a timer that displays in Minutes and seconds! I am using a server script for the timer countdown and a local script in StarterGui for the timer to display.
I’ve been bothered by how the timer looks and I thought that I could make it into a more fancy timer, but I don’t know how I can do this.
Here is what the timer looks like now:
It works fine, there are no errors.
Here is the server script for the timer:
--// Settings
local roundLength = 120
local intermissionLength = 30
local Intermission = false
local RoundRunning = false
local tweenService = game:GetService("TweenService")
local RoundStarted = game.ReplicatedStorage.RoundStarted
local Status = game.ReplicatedStorage.Status
BigCube = game.ServerStorage.BigCubeFolder:GetChildren()
--// Animations
local tween = tweenService:Create(game.Lighting, TweenInfo.new(10), {ClockTime = 0, Brightness = 2} )
local tween2 = tweenService:Create(game.Lighting, TweenInfo.new(10), {ClockTime = 14.5, Brightness = 3})
local tweenCloud = tweenService:Create(game.Workspace.Terrain.Clouds, TweenInfo.new(5.5), {Cover = 0.65, Density = 0.55})
local tweenCloud2 = tweenService:Create(game.Workspace.Terrain.Clouds, TweenInfo.new(10), {Cover = 0.5, Density = 0.55})
local tweenAtmosphere = tweenService:Create(game.Lighting.Atmosphere, TweenInfo.new(15), {Density = 0.55, Offset = 0.8})
local tweenAtmosphere2 = tweenService:Create(game.Lighting.Atmosphere, TweenInfo.new(4.5), {Density = 0.2, Offset = 0})
local intermissionSound = script.IntermissionMusic:Clone()
local survivalSound = script.SurvivalMusic:Clone()
intermissionSound.Parent = workspace
survivalSound.Parent = workspace
local function RunRound()
Intermission = true
intermissionSound:Play()
while wait() do
for i = intermissionLength, 1, -1 do
RoundStarted.Value = false
wait(1)
Status.Value = i
end
tween:Play()
tweenCloud:Play()
tweenAtmosphere:Play()
Intermission = false
intermissionSound:Stop()
local chosen = BigCube[math.random(1, #BigCube)]:Clone()
chosen.Parent = workspace
RoundRunning = true
survivalSound:Play()
Status.Value = "The "..chosen.Name.." is here! Survive!"
for i = roundLength, 1, -1 do
RoundStarted.Value = true
wait(1)
Status.Value = i
end
RoundRunning = false
if RoundRunning == false then
tween2:Play()
tweenCloud2:Play()
tweenAtmosphere2:Play()
survivalSound:Stop()
Status.Value = "The "..chosen.Name.." is gone for now..."
intermissionSound:Play()
else
RoundRunning = true
end
wait(1)
chosen:Destroy()
end
end
spawn(RunRound)
Here is the local script:
function Refresh()
script.Parent.TimerDisplay.Text = game.ReplicatedStorage.Status.Value
end
Refresh()
game.ReplicatedStorage.Status.Changed:Connect(Refresh)
I have a feeling I would need to work on both of these script, but I don’t know what I can do.
How can I do this?