I am trying to make a Game Timer Intermission Timer and a Choosing Team Timer all of the timers work except Choosing team when choosing team countdown starts it freezes until the last few seconds I have tried changing it to a While loop instead but I get the same issue while in the game i checked the Server and in replicated storage the value is going down but in the Client where the Script is checking for the change the value doesn’t change it waits a few seconds
Script that changes the Value Server Script
local replicatedStorage = game:GetService("ReplicatedStorage")
local Values = replicatedStorage:WaitForChild("Stats")
local Status = Values:WaitForChild("Stats")
local InGameValue = Values:WaitForChild("InRound")
local MapsFolder = replicatedStorage:WaitForChild("Maps")
local Maps = MapsFolder:GetChildren()
local Teams = game:GetService("Teams")
local TeamS = Teams.Survivor
local TeamZ = Teams.Zombie
local Players = game:GetService("Players")
local ZLife = replicatedStorage.Stats.ZLivesLeft
local SLife = replicatedStorage.Stats.SLivesLeft
local function changeTimerInter()
Status.Value = 20
for i = 20,0,-1 do--intermission
wait(1)
Status.Value = i
end
Status.Value = 10
replicatedStorage.Stats.SLivesLeft.Value = 5 -- this is for my lives system dont worry about it
replicatedStorage.Stats.ZLivesLeft.Value = 10
InGameValue.Value = true
end
local function TeamChooseTimer()
Status.Value = 10
for i = 10,0,-1 do
wait(1)
Status.Value = i
end
end
local function changeTimerInGame()
Status.Value = 20
for i = 20,0,-1 do--main
if replicatedStorage.Stats.SLivesLeft.Value == 0 or replicatedStorage.Stats.ZLivesLeft.Value == 0 then
break
end
wait(1)
Status.Value = i
end
InGameValue.Value = false
end
InGameValue.Changed:Connect(function(plr)
if InGameValue.Value == true then
local ChosenMap = Maps[math.random(1,#Maps)]
local ClonedMap = ChosenMap:Clone()
ClonedMap.Parent = game.Workspace.Maps
TeamChooseTimer()
changeTimerInGame()
elseif InGameValue.Value == false then
--who won script goes here
print("other thingy")
for i,v in pairs(game.Workspace.Maps:GetChildren()) do
v:Destroy()
end
changeTimerInter()
end
end)
Script that Changes the countdown is a local script
local Status = game:GetService("ReplicatedStorage"):FindFirstChild("Stats")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
ReplicatedStorage.Stats.Stats.Changed:Connect(function() -- changes text to Value
print("detected")
script.Parent.TimeLeft.Text = Status.Stats.Value
end)