This is a module script inside my script…
function TurnOff(Name, LightBar)
for _, i in pairs(LightBar:GetChildren()) do
if i.Name == Name then
i.Material = Enum.Material.SmoothPlastic
i.Color = Color3.fromRGB(91, 93, 105)
end
end
for _, i in pairs(LightBar.Lights:GetChildren()) do
if i.Name == "Center" then
i.Enabled = false
end
end
end
function TurnOn(Name, LightBar)
for _, i in pairs(LightBar:GetChildren()) do
if i.Name == Name then
i.Material = Enum.Material.Neon
if Name == "Blue" then
i.Color = Color3.fromRGB(13, 105, 172)
else
i.Color = Color3.fromRGB(255, 0, 0)
end
end
end
for _, i in pairs(LightBar.Lights:GetChildren()) do
if i.Name == "Center" then
if Name == "Blue" then
i.Color = Color3.fromRGB(0, 0, 255)
else
i.Color = Color3.fromRGB(255, 0, 0)
end
i.Enabled = true
end
end
end
function returnwait(times, CurrentCode, String)
if CurrentCode.Value ~= String then
return false
else
wait(times)
end
end
local Functions = {
Quint = function(LightBar, CurrentCode)
local Code = "Quint"
local WaitTime = .1
while CurrentCode.Value == Code do
TurnOn("Blue", LightBar)
if returnwait(WaitTime, CurrentCode, Code) == false then break end
TurnOff("Blue", LightBar)
if returnwait(WaitTime, CurrentCode, Code) == false then break end
TurnOn("Blue", LightBar)
if returnwait(WaitTime, CurrentCode, Code) == false then break end
TurnOff("Blue", LightBar)
TurnOn("Red", LightBar)
if returnwait(WaitTime, CurrentCode, Code) == false then break end
TurnOff("Red", LightBar)
if returnwait(WaitTime, CurrentCode, Code) == false then break end
TurnOn("Red", LightBar)
if returnwait(WaitTime, CurrentCode, Code) == false then break end
TurnOff("Red", LightBar)
if returnwait(WaitTime, CurrentCode, Code) == false then break end
end
end;
Single = function(LightBar, CurrentCode)
local Code = "Single"
local WaitTime = .2
while CurrentCode.Value == Code do
TurnOn("Blue", LightBar)
if returnwait(WaitTime, CurrentCode, Code) == false then break end
TurnOff("Blue", LightBar)
TurnOn("Red", LightBar)
if returnwait(WaitTime, CurrentCode, Code) == false then break end
TurnOff("Red", LightBar)
end
end;
Cycle = function(LightBar, CurrentCode)
local Code = "Cycle"
local WaitTime = .1
while CurrentCode.Value == Code do
TurnOn("Blue", LightBar)
TurnOn("Red", LightBar)
for _, i in pairs(LightBar.Lights:GetChildren()) do i.Color = Color3.fromRGB(0, 0, 255) end
if returnwait(WaitTime, CurrentCode, Code) == false then break end
TurnOff("Blue", LightBar)
TurnOff("Red", LightBar)
if returnwait(WaitTime, CurrentCode, Code) == false then break end
TurnOn("Blue", LightBar)
TurnOn("Red", LightBar)
for _, i in pairs(LightBar.Lights:GetChildren()) do i.Color = Color3.fromRGB(255, 0, 0) end
if returnwait(WaitTime, CurrentCode, Code) == false then break end
TurnOff("Blue", LightBar)
TurnOff("Red", LightBar)
if returnwait(.4, CurrentCode, Code) == false then break end
end
end;
Stop = function(LightBar, CurrentCode)
for i = 0,1,.1 do
TurnOff("Blue", LightBar)
TurnOff("Red", LightBar)
wait()
end
end
}
return Functions