local l=game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")local d=game:GetService("\082\117\110\083\101\114\118\105\099\101")local Z=game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")local z=game.Players.LocalPlayer local w=z.Character or z.CharacterAdded:Wait()local J=script.Parent.Parent:WaitForChild("\086\097\108\117\101\115")local n=script.Parent.Parent.Car.Value local c=n:WaitForChild("\068\114\105\118\101\083\101\097\116")local f=require(n:WaitForChild("\065-\067\104\097\115\115\105\115 \084\117\110\101"))local Q=J.Parent:WaitForChild("\073\115\079\110")local q=n:WaitForChild("\076\105\103\104\116\069\118\101\110\116")local X=script.Values.Left local R=script.Values.Right local L=script.Values.Hazard local t=script.Values.RunningLights local D=script.Values.Headlights local N=false local y=1 local V=false local T=false local G=false local j=false local M=TweenInfo.new(.5,Enum.EasingStyle.Quint,Enum.EasingDirection.Out,0,false,0)local U=TweenInfo.new(Indicator_Flash_Rate/2.5,Enum.EasingStyle.Quint,Enum.EasingDirection.Out,0,false,0)function input(l,d)if not d then if l.KeyCode==Headlights then if D.Value==0 then D.Value=1 q:FireServer("\072\101\097\100\108\105\103\104\116\115",Low_Beam_Brightness,.2,48,T,Popups_Enabled,Headlight_Type,D.Value)q:FireServer("\082\101\097\114\076\105\103\104\116\115",Rear_Light_Type,Rear_Light_Brightness,.2,Trunk_Lights)if G then q:FireServer("\070\111\103\076\105\103\104\116\115",Fog_Light_Brightness,.02,Fog_Light_Type);(Z:Create(script.Parent.FogLights,M,{ImageTransparency=0})):Play()end;(Z:Create(script.Parent.LowBeams,M,{ImageTransparency=0})):Play()elseif D.Value==1 then D.Value=2 q:FireServer("\072\101\097\100\108\105\103\104\116\115",High_Beam_Brightness,.02,60,T,Popups_Enabled,Headlight_Type,D.Value);(Z:Create(script.Parent.LowBeams,M,{ImageTransparency=1})):Play();(Z:Create(script.Parent.HighBeams,M,{ImageTransparency=0})):Play()elseif D.Value==2 then D.Value=0 q:FireServer("\072\101\097\100\108\105\103\104\116\115",0,1,60,T,Popups_Enabled,Headlight_Type,D.Value)q:FireServer("\082\101\097\114\076\105\103\104\116\115",Rear_Light_Type,0,1,Trunk_Lights)q:FireServer("\070\111\103\076\105\103\104\116\115",0,1,Fog_Light_Type);(Z:Create(script.Parent.LowBeams,M,{ImageTransparency=1})):Play();(Z:Create(script.Parent.HighBeams,M,{ImageTransparency=1})):Play();(Z:Create(script.Parent.FogLights,M,{ImageTransparency=1})):Play()end if Plate_Lights then if D.Value>=1 then q:FireServer("\080\108\097\116\101\076\105\103\104\116\115",true,Plate_Light_Type)else q:FireServer("\080\108\097\116\101\076\105\103\104\116\115",false,Plate_Light_Type)end end elseif l.KeyCode==Popups then if Popups_Enabled then if j==false then q:FireServer("\080\111\112\117\112\115",true,Popups_Enabled,Popup_Hinge_Angle)j=true else q:FireServer("\080\111\112\117\112\115",false,Popups_Enabled,Popup_Hinge_Angle)j=false end end elseif l.KeyCode==RunningLights then if not T then T=true;(Z:Create(script.Parent.ParkLights,M,{ImageTransparency=0})):Play()else T=false;(Z:Create(script.Parent.ParkLights,M,{ImageTransparency=1})):Play()end if D.Value==0 then q:FireServer("\072\101\097\100\108\105\103\104\116\115",0,1,60,T,Popups_Enabled,Headlight_Type,D.Value)end elseif l.KeyCode==FogLights then if D.Value>0 then if not G then q:FireServer("\070\111\103\076\105\103\104\116\115",Fog_Light_Brightness,.02,Fog_Light_Type);(Z:Create(script.Parent.FogLights,M,{ImageTransparency=0})):Play()G=true else q:FireServer("\070\111\103\076\105\103\104\116\115",0,1,Fog_Light_Type);(Z:Create(script.Parent.FogLights,M,{ImageTransparency=1})):Play()G=false end else if not G then G=true else G=false end end elseif l.KeyCode==Flash then if not V then end elseif l.KeyCode==SignalLeft then if not X.Value then X.Value=true script.StackOn:Play()else X.Value=false script.StackOff:Play()end elseif l.KeyCode==SignalRight then if not R.Value then R.Value=true script.StackOn:Play()else R.Value=false script.StackOff:Play()end elseif l.KeyCode==Hazards then if not L.Value then L.Value=true else L.Value=false end end end end


local UIS = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local Values = script.Parent.Parent:WaitForChild("Values")
local car = script.Parent.Parent.Car.Value
local DriveSeat = car:WaitForChild("DriveSeat")
local Tune = require(car:WaitForChild("A-Chassis Tune"))
local IsOn = Values.Parent:WaitForChild("IsOn")
local LightEvent = car:WaitForChild("LightEvent")

local LI = script.Values.Left
local RI = script.Values.Right
local H = script.Values.Hazard
local RL = script.Values.RunningLights
local HL = script.Values.Headlights

local setup = false
local current_seq_seg = 1
local flashing = false
local parklightActive = false
local fogActive = false
local popupsActive = false

local gui_tweeninfo = TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)
local indgui_tweeninfo = TweenInfo.new(Indicator_Flash_Rate / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)

function input(key, gameprocessed)
	if not gameprocessed then
		if key.KeyCode == Headlights then
			if HL.Value == 0 then
				HL.Value = 1
				LightEvent:FireServer("Headlights", Low_Beam_Brightness, 0.2, 48, parklightActive, Popups_Enabled, Headlight_Type, HL.Value)
				LightEvent:FireServer("RearLights", Rear_Light_Type, Rear_Light_Brightness, 0.2, Trunk_Lights)
				if fogActive then
					LightEvent:FireServer("FogLights", Fog_Light_Brightness, 0.02, Fog_Light_Type)
					TweenService:Create(script.Parent.FogLights, gui_tweeninfo, {ImageTransparency = 0}):Play()
				end
				TweenService:Create(script.Parent.LowBeams, gui_tweeninfo, {ImageTransparency = 0}):Play()
			elseif HL.Value == 1 then
				HL.Value = 2		
				LightEvent:FireServer("Headlights", High_Beam_Brightness, 0.02, 60, parklightActive, Popups_Enabled, Headlight_Type, HL.Value)
				TweenService:Create(script.Parent.LowBeams, gui_tweeninfo, {ImageTransparency = 1}):Play()
				TweenService:Create(script.Parent.HighBeams, gui_tweeninfo, {ImageTransparency = 0}):Play()
			elseif HL.Value == 2 then	
				HL.Value = 0
				LightEvent:FireServer("Headlights", 0, 1, 60, parklightActive, Popups_Enabled, Headlight_Type, HL.Value)
				LightEvent:FireServer("RearLights", Rear_Light_Type, 0, 1, Trunk_Lights)
				LightEvent:FireServer("FogLights", 0, 1, Fog_Light_Type)
				TweenService:Create(script.Parent.LowBeams, gui_tweeninfo, {ImageTransparency = 1}):Play()
				TweenService:Create(script.Parent.HighBeams, gui_tweeninfo, {ImageTransparency = 1}):Play()
				TweenService:Create(script.Parent.FogLights, gui_tweeninfo, {ImageTransparency = 1}):Play()
			end	
			if Plate_Lights then
				if HL.Value >= 1 then
					LightEvent:FireServer("PlateLights", true, Plate_Light_Type)
				else	
					LightEvent:FireServer("PlateLights", false, Plate_Light_Type)
				end
			end
		elseif key.KeyCode == Popups then
			if Popups_Enabled then
				if popupsActive == false then
					LightEvent:FireServer("Popups", true, Popups_Enabled, Popup_Hinge_Angle)
					popupsActive = true
				else
					LightEvent:FireServer("Popups", false, Popups_Enabled, Popup_Hinge_Angle)
					popupsActive = false				
				end
			end	
		elseif key.KeyCode == RunningLights then
			if not parklightActive then
				parklightActive = true
				TweenService:Create(script.Parent.ParkLights, gui_tweeninfo, {ImageTransparency = 0}):Play()
			else
				parklightActive = false
				TweenService:Create(script.Parent.ParkLights, gui_tweeninfo, {ImageTransparency = 1}):Play()
			end
			if HL.Value == 0 then
				LightEvent:FireServer("Headlights", 0, 1, 60, parklightActive, Popups_Enabled, Headlight_Type, HL.Value)
			end
		elseif key.KeyCode == FogLights then
			if HL.Value > 0 then
				if not fogActive then
					LightEvent:FireServer("FogLights", Fog_Light_Brightness, 0.02, Fog_Light_Type)
					TweenService:Create(script.Parent.FogLights, gui_tweeninfo, {ImageTransparency = 0}):Play()
					fogActive = true
				else
					LightEvent:FireServer("FogLights", 0, 1, Fog_Light_Type)
					TweenService:Create(script.Parent.FogLights, gui_tweeninfo, {ImageTransparency = 1}):Play()
					fogActive = false					
				end
			else
				if not fogActive then
					fogActive = true
				else
					fogActive = false
				end
			end
		elseif key.KeyCode == Flash then
			if not flashing then

			end
		elseif key.KeyCode == SignalLeft then
			if not LI.Value then
				LI.Value = true
				script.StackOn:Play()
			else
				LI.Value = false
				script.StackOff:Play()
			end	
		elseif key.KeyCode == SignalRight then
			if not RI.Value then
				RI.Value = true
				script.StackOn:Play()
			else
				RI.Value = false
				script.StackOff:Play()
			end
		elseif key.KeyCode == Hazards then
			if not H.Value then
				H.Value = true
			else
				H.Value = false	
			end
		end
	end
end

