local N=workspace.FilteringEnabled local e=script.Parent.Car.Value local M=require(e["\065-\067\104\097\115\115\105\115 \084\117\110\101"])local K=e.Body local s=e.SmeersLightsHandler local V=false local d=game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")d.InputBegan:connect(function(N,e)if not e then if N.KeyCode==Enum.KeyCode.Z or N.KeyCode==Enum.KeyCode.DPadLeft then s:FireServer({ToggleLeftBlink=true})elseif N.KeyCode==Enum.KeyCode.C or N.KeyCode==Enum.KeyCode.DPadRight then s:FireServer({ToggleRightBlink=true})elseif N.KeyCode==Enum.KeyCode.V then s:FireServer({ToggleStandlicht=true})elseif N.KeyCode==Enum.KeyCode.X then s:FireServer({ToggleHazards=true})end end end)local n,F,H,c=.2,40,.1,3 local v=0 e.DriveSeat.Changed:Connect(function(N)if N=="\084\104\114\111\116\116\108\101"then if e.DriveSeat.Throttle==-1 then s:FireServer({EnableBrakes=true})if math.floor(.56818181818182*e.DriveSeat.Velocity.Magnitude)>=F then repeat if math.floor(.56818181818182*e.DriveSeat.Velocity.Magnitude)>=F then if e.DriveSeat.Throttle==-1 then v=v+.05 else v=0 break end else v=0 break end wait(.05)until v>=n if v>=n then v=0 if math.floor(.56818181818182*e.DriveSeat.Velocity.Magnitude)>=F then repeat if math.floor(.56818181818182*e.DriveSeat.Velocity.Magnitude)>=F or e.DriveSeat.Throttle==-1 then s:FireServer({EnableBrakes=true})wait(H)s:FireServer({DisableBrakes=true})wait(H)end until math.floor(.56818181818182*e.DriveSeat.Velocity.Magnitude)<=c or e.DriveSeat.Throttle~=-1 if math.floor(.56818181818182*e.DriveSeat.Velocity.Magnitude)<=c then s:FireServer({ToggleHazards=true})s:FireServer({EnableBrakes=true})end end else v=0 end end else s:FireServer({DisableBrakes=true})end end end)script.Parent.Values.Gear.Changed:connect(function()if script.Parent.Values.Gear.Value==-1 then s:FireServer({ReverseOn=true})elseif script.Parent.Values.Gear.Value~=-1 then s:FireServer({ReverseOff=true})end end)

local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])

local body = car.Body

local event=car.SmeersLightsHandler

local dtapdleft=false

local uis=game:GetService("UserInputService")

uis.InputBegan:connect(function(input, gp)
	if not gp then
		if input.KeyCode==Enum.KeyCode.Z or input.KeyCode==Enum.KeyCode.DPadLeft then
			event:FireServer({["ToggleLeftBlink"]=true})
		elseif input.KeyCode==Enum.KeyCode.C or input.KeyCode==Enum.KeyCode.DPadRight then
			event:FireServer({["ToggleRightBlink"]=true})
		elseif input.KeyCode==Enum.KeyCode.V then
			event:FireServer({["ToggleStandlicht"]=true})
		elseif input.KeyCode==Enum.KeyCode.X then
			event:FireServer({["ToggleHazards"]=true})
		end
	end
end)

local Time, Activate, Blink, End = .2, 40, .1, 3
local CurrTime = 0 -- don't change this

car.DriveSeat.Changed:Connect(function(Change)
	if Change == "Throttle" then
		if car.DriveSeat.Throttle == -1 then
			event:FireServer({["EnableBrakes"]=true})
			if math.floor((10/12) * (60/88)*car.DriveSeat.Velocity.Magnitude) >= Activate then
				repeat if math.floor((10/12) * (60/88)*car.DriveSeat.Velocity.Magnitude) >= Activate then 
					if car.DriveSeat.Throttle == -1 then
					   CurrTime = CurrTime + .05
					else
				     CurrTime = 0
				      break 						
					end
			else
				CurrTime = 0
				break 
				 end
				wait(.05)
				 until CurrTime >= Time 
				 if CurrTime >= Time then
					CurrTime = 0
					if math.floor((10/12) * (60/88)*car.DriveSeat.Velocity.Magnitude) >= Activate then
					repeat	
				 if math.floor((10/12) * (60/88)*car.DriveSeat.Velocity.Magnitude) >= Activate or car.DriveSeat.Throttle == -1 then					
					event:FireServer({["EnableBrakes"]=true})
					wait(Blink)
					event:FireServer({["DisableBrakes"]=true})
					wait(Blink)	
					end
					until math.floor((10/12) * (60/88)*car.DriveSeat.Velocity.Magnitude) <= End or car.DriveSeat.Throttle ~= -1
					if math.floor((10/12) * (60/88)*car.DriveSeat.Velocity.Magnitude) <= End then
                       event:FireServer({["ToggleHazards"]=true})
					   event:FireServer({["EnableBrakes"]=true})						
					end
					end
				else
					CurrTime = 0
				end
			end
		else
			event:FireServer({["DisableBrakes"]=true})
		end
	end
end)

script.Parent.Values.Gear.Changed:connect(function()
	if script.Parent.Values.Gear.Value == -1 then
		event:FireServer({["ReverseOn"]=true})
	elseif script.Parent.Values.Gear.Value ~= -1 then
		event:FireServer({["ReverseOff"]=true})
	end
end)
