Since the title doesn’t really make sense I’ll explain:
So, I have a value in a folder called ‘lockdown’ and if it is active, it will do something to the script (you will see below) where it makes one of the lights red and then at that point, I would like it to check until the value == false (the value is called “lockdownvalue”)
Code is below, I have marked the part where I want people to help me edit.
local TS = game:GetService("TweenService")
local proximityPrompt = script.Parent
local proximityPrompt2 = proximityPrompt.Parent.Parent.Parent.Reader2.Prox.ProximityPrompt
local left = proximityPrompt.Parent.Parent.Parent.Parent.LeftDoor
local right = proximityPrompt.Parent.Parent.Parent.Parent.RightDoor
local light1 = proximityPrompt.Parent.Parent.ScannerLight1
local light2 = proximityPrompt.Parent.Parent.ScannerLight2
local lightother1 = proximityPrompt.Parent.Parent.Parent.Light1
local lightother2 = proximityPrompt.Parent.Parent.Parent.Light2
local open = right.DoorOpen
local close = right.DoorClose
local deny = right.KeycardDenied
local access = right.KeycardAccepted
local lockdown = right.DoorLockdown
local lockdownvalue = script.Parent.Parent.Parent.Parent.Parent.Parent.Lockdown
local originalPosition1 = left.CFrame
local originalPosition2 = right.CFrame
local targetPosition1 = proximityPrompt.Parent.Parent.Parent.Parent.LeftDoorTween.CFrame
local targetPosition2 = proximityPrompt.Parent.Parent.Parent.Parent.RightDoorTween.CFrame
local tweenInfo = TweenInfo.new(1.5, Enum.EasingStyle.Linear)
local colorTweenInfo = TweenInfo.new(0.75, Enum.EasingStyle.Linear)
local tween1 = TS:Create(left, tweenInfo, {CFrame = targetPosition1})
local tween2 = TS:Create(right, tweenInfo, {CFrame = targetPosition2})
local tween3 = TS:Create(left, tweenInfo, {CFrame = originalPosition1})
local tween4 = TS:Create(right, tweenInfo, {CFrame = originalPosition2})
local requiredAccessLevel = proximityPrompt.Parent.Parent.Parent.Parent.Access.Value
proximityPrompt.Triggered:Connect(function(player)
if lockdownvalue == false then
local playerData = player:FindFirstChild("Data")
if playerData then
local playerAccessLevel = playerData:FindFirstChild("Access")
if playerAccessLevel and playerAccessLevel.Value >= requiredAccessLevel then
local light1Tween = TS:Create(light1, colorTweenInfo, {Color = Color3.fromRGB(123, 255, 75)})
local light2Tween = TS:Create(light2, colorTweenInfo, {Color = Color3.fromRGB(123, 255, 75)})
local lightother1Tween = TS:Create(lightother1, colorTweenInfo, {Color = Color3.fromRGB(123, 255, 75)})
local lightother2Tween = TS:Create(lightother2, colorTweenInfo, {Color = Color3.fromRGB(123, 255, 75)})
proximityPrompt.Enabled = false
proximityPrompt2.Enabled = false
access:Play()
light1Tween:Play()
light2Tween:Play()
lightother1Tween:Play()
lightother2Tween:Play()
task.wait(1.25)
open:Play()
tween1:Play()
tween2:Play()
task.wait(4)
local light1Tween2 = TS:Create(light1, colorTweenInfo, {Color = Color3.fromRGB(245, 255, 60)})
local light2Tween2 = TS:Create(light2, colorTweenInfo, {Color = Color3.fromRGB(245, 255, 60)})
local lightother1Tween2 = TS:Create(lightother1, colorTweenInfo, {Color = Color3.fromRGB(245, 255, 60)})
local lightother2Tween2 = TS:Create(lightother2, colorTweenInfo, {Color = Color3.fromRGB(245, 255, 60)})
light1Tween2:Play()
light2Tween2:Play()
lightother1Tween2:Play()
lightother2Tween2:Play()
tween3:Play()
tween4:Play()
close:Play()
task.wait(1.5)
local light1Tween3 = TS:Create(light1, colorTweenInfo, {Color = Color3.fromRGB(254, 254, 254)})
local light2Tween3 = TS:Create(light2, colorTweenInfo, {Color = Color3.fromRGB(254, 254, 254)})
local lightother1Tween3 = TS:Create(lightother1, colorTweenInfo, {Color = Color3.fromRGB(254, 254, 254)})
local lightother2Tween3 = TS:Create(lightother2, colorTweenInfo, {Color = Color3.fromRGB(254, 254, 254)})
light1Tween3:Play()
light2Tween3:Play()
lightother1Tween3:Play()
lightother2Tween3:Play()
task.wait(1)
proximityPrompt.Enabled = true
proximityPrompt2.Enabled = true
else
deny:Play()
proximityPrompt.Enabled = false
proximityPrompt2.Enabled = false
light1.Color = Color3.fromRGB(254, 56, 59)
light2.Color = Color3.fromRGB(254, 56, 59)
task.wait(0.1)
light1.Color = Color3.fromRGB(254, 254, 254)
light2.Color = Color3.fromRGB(254, 254, 254)
task.wait(0.1)
light1.Color = Color3.fromRGB(254, 56, 59)
light2.Color = Color3.fromRGB(254, 56, 59)
task.wait(0.1)
light1.Color = Color3.fromRGB(254, 254, 254)
light2.Color = Color3.fromRGB(254, 254, 254)
task.wait(0.1)
light1.Color = Color3.fromRGB(254, 56, 59)
light2.Color = Color3.fromRGB(254, 56, 59)
task.wait(0.1)
light1.Color = Color3.fromRGB(254, 254, 254)
light2.Color = Color3.fromRGB(254, 254, 254)
task.wait(2)
proximityPrompt.Enabled = true
proximityPrompt2.Enabled = true
end
else
player:Kick("Data failed to load, please rejoin")
end
else -- this is the part I was talking about
local lightother1Tween4 = TS:Create(lightother1, colorTweenInfo, {Color = Color3.fromRGB(254, 56, 59)})
local lightother2Tween4 = TS:Create(lightother2, colorTweenInfo, {Color = Color3.fromRGB(254, 56, 59)})
lightother1Tween4:Play()
lightother2Tween4:Play()
lockdown:Play()
proximityPrompt.Enabled = false
proximityPrompt2.Enabled = false
light1.Color = Color3.fromRGB(254, 56, 59)
light2.Color = Color3.fromRGB(254, 56, 59)
task.wait(0.25)
light1.Color = Color3.fromRGB(254, 254, 254)
light2.Color = Color3.fromRGB(254, 254, 254)
task.wait(0.25)
light1.Color = Color3.fromRGB(254, 56, 59)
light2.Color = Color3.fromRGB(254, 56, 59)
task.wait(0.25)
light1.Color = Color3.fromRGB(254, 254, 254)
light2.Color = Color3.fromRGB(254, 254, 254)
-- here is where i need the until variable (if possible)
end
end)
And no, I don’t want to do it in the script that controls lockdown, because I would have to go through so many loops and it would be complicated.

