So pretty much this timer is well… just a timer. Everything works fine with it but whenever a player leaves and rejoins or a player just joins, it starts an entirely new time for them. So 4 clients who have been in the server will see 4 minutes for example, while this new player who joined sees 10 minutes.
local Timer = script.Parent
local Minutes = 10
local Seconds = 0
local Start = game.Workspace.Values.StartClockValue
local Halve = 1
Start:GetPropertyChangedSignal(“Value”):Connect(function()
while Start.Value == 1 do
if Seconds <= 0 then
Minutes = Minutes - 1
Seconds = 59
Timer.Text = tostring(Minutes)…“:”…tostring(Seconds)
else
Seconds = Seconds - 1
end
if Seconds <= 9 then
Timer.Text = tostring(Minutes)…“:0”…tostring(Seconds)
else
Timer.Text = tostring(Minutes)…“:”…tostring(Seconds)
end
wait(1)
if Minutes <= 0 and Seconds <= 0 and Halve <= 1 then
Halve = 2
Start.Value = 0
print(“Using 2nd Halve”)
Timer.Text = “00:00”
game.ReplicatedStorage.Events.GoToLockerRoom:FireAllClients()
wait(1)
Timer.Text = “10:00”
Minutes = 10
Seconds = 0
game.ReplicatedStorage.Events.PeriodOver:FireAllClients()
end
if Minutes <= 0 and Seconds <= 0 and Start.Value == 1 and Halve >= 2 then
Start.Value = 0
print(“Ending game”)
game.ReplicatedStorage.GUIEvent.GameOver:FireAllClients()
Halve = 1
Seconds = 0
Minutes = 10
end
end
end)
Any help is much appreciated. Thank you.