I'm making a "prison" script in which when the suspect is sent here, it displays a "Time until release" gui that shows the time left in seconds. The problem is that either gradually or immediately, it starts to decrease by two, instead of one. This script is nested inside of a "Character Added" events inside of a "Player added" event. This is the only code that interacts with the time-left value, so this HAS to be the problem somehow, but I don't know how.
if p.TeamColor == BrickColor.new("Neon orange") then -- if player is on the "prison team"
p:WaitForChild("PlayerGui"):WaitForChild("GameScreens"):WaitFor Child("CornerGUI").Enabled = false
enableJailGUIEvent:FireClient(p) -- enabled countdown GUI
repeat
jailTime:Increment(-1,0) -- Decreases the timeleft Value
wait(1)
until
p:WaitForChild("Settings"):WaitForChild("Jail"):WaitForChild("JailTime").Value <= -1 -- until the time is below zero
p.TeamColor = BrickColor.new("Bright blue") -- switch to citizen team
p:LoadCharacter()
end
