---------------------------------------------------

This = script.Parent
Lift = This.Parent.Parent.Parent
CustomLabel = require(This.Parent.Parent.Parent.CustomLabel)
Characters = require(script.Characters)

ArwTime = 0.2

CustomText = CustomLabel["CUSTOMFLOORLABEL"]

Lift:WaitForChild("Floor").Changed:connect(function(floor)
  --custom indicator code--
  ChangeFloor(tostring(floor))
end)

function ChangeFloor(SF)
	if CustomText[tonumber(SF)] then
		SF = CustomText[tonumber(SF)]
	end
	SetDisplay(1,(string.len(SF) == 2 and SF:sub(1,1) or "NIL"))		
	SetDisplay(2,(string.len(SF) == 2 and SF:sub(2,2) or SF))
end



function SetDisplay(ID,CHAR)
	if This.Display:FindFirstChild("DIG"..ID) and Characters[CHAR] ~= nil then
 		for i,l in pairs(Characters[CHAR]) do 
			for r=1,101 do	
				This.Display["DIG"..ID]["D"..r].Color = (l:sub(r,r) == "1" and enabledClr or disabledClr)
			end
		end
	end
end

while wait() do
    if Lift:WaitForChild("MotorMode").Value ~= "idle" then
	    if Lift:WaitForChild("Direction").Value == 1 then
			This.Display.ARW1.U1.Color = arwFadingUp1
			This.Display.ARW1.U2.Color = arwFadingUp2
			This.Display.ARW1.U3.Color = arwFadingUp3
			This.Display.ARW1.D1.Color = disabledClr
			This.Display.ARW1.D2.Color = disabledClr
			This.Display.ARW1.D3.Color = disabledClr
			wait(ArwTime)
			This.Display.ARW1.U1.Color = disabledClr
			This.Display.ARW1.U2.Color = arwFadingUp1
			This.Display.ARW1.U3.Color = arwFadingUp2
			This.Display.ARW1.D1.Color = disabledClr
			This.Display.ARW1.D2.Color = disabledClr
			This.Display.ARW1.D3.Color = disabledClr
			wait(ArwTime)
			This.Display.ARW1.U1.Color = disabledClr
			This.Display.ARW1.U2.Color = disabledClr
			This.Display.ARW1.U3.Color = arwFadingUp1
			This.Display.ARW1.D1.Color = disabledClr
			This.Display.ARW1.D2.Color = disabledClr
			This.Display.ARW1.D3.Color = disabledClr
			wait(ArwTime)
			This.Display.ARW1.U1.Color = disabledClr
			This.Display.ARW1.U2.Color = disabledClr
			This.Display.ARW1.U3.Color = disabledClr
			This.Display.ARW1.D1.Color = disabledClr
			This.Display.ARW1.D2.Color = disabledClr
			This.Display.ARW1.D3.Color = disabledClr
			wait(ArwTime)
			This.Display.ARW1.U1.Color = arwFadingUp3
			This.Display.ARW1.U2.Color = disabledClr
			This.Display.ARW1.U3.Color = disabledClr
			This.Display.ARW1.D1.Color = disabledClr
			This.Display.ARW1.D2.Color = disabledClr
			This.Display.ARW1.D3.Color = disabledClr
			wait(ArwTime)
			This.Display.ARW1.U1.Color = arwFadingUp2
			This.Display.ARW1.U2.Color = arwFadingUp3
			This.Display.ARW1.U3.Color = disabledClr
			This.Display.ARW1.D1.Color = disabledClr
			This.Display.ARW1.D2.Color = disabledClr
			This.Display.ARW1.D3.Color = disabledClr
			wait(ArwTime)
	    elseif Lift:WaitForChild("Direction").Value == -1 then
			This.Display.ARW1.U1.Color = disabledClr
			This.Display.ARW1.U2.Color = disabledClr
			This.Display.ARW1.U3.Color = disabledClr
			This.Display.ARW1.D1.Color = arwFadingDown1
			This.Display.ARW1.D2.Color = arwFadingDown2
			This.Display.ARW1.D3.Color = arwFadingDown3
			wait(ArwTime)
			This.Display.ARW1.U1.Color = disabledClr
			This.Display.ARW1.U2.Color = disabledClr
			This.Display.ARW1.U3.Color = disabledClr
			This.Display.ARW1.D1.Color = disabledClr
			This.Display.ARW1.D2.Color = arwFadingDown1
			This.Display.ARW1.D3.Color = arwFadingDown2
			wait(ArwTime)
			This.Display.ARW1.U1.Color = disabledClr
			This.Display.ARW1.U2.Color = disabledClr
			This.Display.ARW1.U3.Color = disabledClr
			This.Display.ARW1.D1.Color = disabledClr
			This.Display.ARW1.D2.Color = disabledClr
			This.Display.ARW1.D3.Color = arwFadingDown1
			wait(ArwTime)
			This.Display.ARW1.U1.Color = disabledClr
			This.Display.ARW1.U2.Color = disabledClr
			This.Display.ARW1.U3.Color = disabledClr
			This.Display.ARW1.D1.Color = disabledClr
			This.Display.ARW1.D2.Color = disabledClr
			This.Display.ARW1.D3.Color = disabledClr
			wait(ArwTime)
			This.Display.ARW1.U1.Color = disabledClr
			This.Display.ARW1.U2.Color = disabledClr
			This.Display.ARW1.U3.Color = disabledClr
			This.Display.ARW1.D1.Color = arwFadingDown3
			This.Display.ARW1.D2.Color = disabledClr
			This.Display.ARW1.D3.Color = disabledClr
			wait(ArwTime)
			This.Display.ARW1.U1.Color = disabledClr
			This.Display.ARW1.U2.Color = disabledClr
			This.Display.ARW1.U3.Color = disabledClr
			This.Display.ARW1.D1.Color = arwFadingDown2
			This.Display.ARW1.D2.Color = arwFadingDown3
			This.Display.ARW1.D3.Color = disabledClr
			wait(ArwTime)
		else
			This.Display.ARW1.U1.Color = disabledClr
			This.Display.ARW1.U2.Color = disabledClr
			This.Display.ARW1.U3.Color = disabledClr
			This.Display.ARW1.D1.Color = disabledClr
			This.Display.ARW1.D2.Color = disabledClr
			This.Display.ARW1.D3.Color = disabledClr
	    end
	else
	    if Lift:WaitForChild("Direction").Value == 1 then
			This.Display.ARW1.U1.Color = arwFadingUp1
			This.Display.ARW1.U2.Color = arwFadingUp2
			This.Display.ARW1.U3.Color = arwFadingUp3
			This.Display.ARW1.D1.Color = disabledClr
			This.Display.ARW1.D2.Color = disabledClr
			This.Display.ARW1.D3.Color = disabledClr
	    elseif Lift:WaitForChild("Direction").Value == -1 then
			This.Display.ARW1.U1.Color = disabledClr
			This.Display.ARW1.U2.Color = disabledClr
			This.Display.ARW1.U3.Color = disabledClr
			This.Display.ARW1.D1.Color = arwFadingDown1
			This.Display.ARW1.D2.Color = arwFadingDown2
			This.Display.ARW1.D3.Color = arwFadingDown3
		else
			This.Display.ARW1.U1.Color = disabledClr
			This.Display.ARW1.U2.Color = disabledClr
			This.Display.ARW1.U3.Color = disabledClr
			This.Display.ARW1.D1.Color = disabledClr
			This.Display.ARW1.D2.Color = disabledClr
			This.Display.ARW1.D3.Color = disabledClr
	    end
	end

	if Lift:WaitForChild("Mode").Value ~= "auto" then
		This.Legends.OOS.Color = oosClr
	else
		This.Legends.OOS.Color = disabledClr
	end

	if Lift.Car.Sensor:FindFirstChild("Script") then
		if Lift.Car.Sensor.Script.IsOverload.Value == true then
			This.Legends.OL.Color = overloadClr
		else
			This.Legends.OL.Color = disabledClr
		end
	end

	if Lift.Car.Platform:FindFirstChild("Alarm") then
		if Lift.Car.Platform.Alarm.Playing == true then
			This.Legends.AL.Color = alarmClr
		else
			This.Legends.AL.Color = disabledClr
		end
	end
end