Repeat Until Statement Issues

  1. What do you want to achieve? My game continues to freeze when running a “repeat until” statement.

  2. What is the issue? Game continues to crash.

  3. What solutions have you tried so far? I have tried adding in “game:GetService(“RunService”).RenderStepped:wait()” and waits.

Ok so, the issue is my game continues to freeze and crash. I know this is because of the repeat until statement, however I am unsure of exactly what I would need to change to fix this.

local RSMS = ReplicatedStorage:WaitForChild("Map System")

local LoadingMapOn = RSMS:WaitForChild("LoadingMapOn")
local LoadingMapOff = RSMS:WaitForChild("LoadingMapOff")
local Intermission = RSMS:WaitForChild("Intermission")
local Timer = RSMS:WaitForChild("Timer")

local BV = ReplicatedStorage:WaitForChild("Bool Values")
local IntermissionValue = BV:WaitForChild("Intermission")

Intermission.OnClientEvent:Connect(function()
	repeat until IntermissionValue.Value == "0" do
		script.Parent:WaitForChild("Intermission").Text = "Intermission: "..IntermissionValue.Value
		wait(1)
	end
end)

I’d try a different approach to it.

repeat
	script.Parent:WaitForChild("Intermission").Text = "Intermission: "..IntermissionValue.Value
    wait(1)
until IntermissionValue.Value == "0"
1 Like