Hello, I have a bit of code that when the variable camerastate is changed, it doesn’t change to the next function. What it is supposed to do is break the repeat until loop and move on to the next set of cameras.
local function idle()
repeat
local idlecameras = cameras.Idle_Cams
local camerasequence = {idlecameras.Cam1, idlecameras.Cam2, idlecameras.Cam3, idlecameras.Cam4, idlecameras.Cam5, idlecameras.Cam6, idlecameras.Cam7}
for i = 1, #camerasequence - 1 do
local ran = math.random(i, #camerasequence)
camerasequence[i], camerasequence[ran] = camerasequence[ran], camerasequence[i]
end
for i, v in pairs(camerasequence) do
if camerastate.Value == "Idle" and tv_mode_enabled.Value then
if v.Name == "Cam1" then
camera.CFrame = v.CFrame
wait(0.7)
local ti = TweenInfo.new(8, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local Goal = {CFrame = idlecameras.Cam1End.CFrame}
current_tween = TweenService:Create(camera, ti, Goal)
current_tween:Play()
wait(9)
elseif v.Name == "Cam2" then
camera.CFrame = v.CFrame
wait(4.5)
elseif v.Name == "Cam3" then
camera.CFrame = v.CFrame
wait(0.7)
local ti = TweenInfo.new(8, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local Goal = {CFrame = idlecameras.Cam3End.CFrame}
current_tween = TweenService:Create(camera, ti, Goal)
current_tween:Play()
wait(9)
elseif v.Name == "Cam4" then
camera.CFrame = v.CFrame
wait(0.7)
local ti = TweenInfo.new(8, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local Goal = {CFrame = idlecameras.Cam4End.CFrame}
current_tween = TweenService:Create(camera, ti, Goal)
current_tween:Play()
wait(9)
elseif v.Name == "Cam5" then
camera.CFrame = v.CFrame
wait(0.7)
local ti = TweenInfo.new(8, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local Goal = {CFrame = idlecameras.Cam5End.CFrame}
current_tween = TweenService:Create(camera, ti, Goal)
current_tween:Play()
wait(9)
elseif v.Name == "Cam6" then
camera.CFrame = v.CFrame
wait(4.5)
elseif v.Name == "Cam7" then
camera.CFrame = v.CFrame
wait(4.5)
end
else
break
end
end
until not tv_mode_enabled.Value or camerastate.Value ~= "Idle"
end
My goal is to implement current_tween:Pause() so that it skips the wait and moves on to the next.