-------------------------
 
mouse.KeyDown:connect(function (key)
    key = string.lower(key)
		if key == "k" then --Camera controls
	        if cam == ("car") then
				Camera.CameraSubject = player.Character.Humanoid
				Camera.CameraType = ("Custom")
				cam = ("freeplr")
				Camera.FieldOfView = 70
			elseif cam == ("freeplr") then
				Camera.CameraSubject = player.Character.Humanoid
				Camera.CameraType = ("Attach")
				cam = ("lockplr")
				Camera.FieldOfView = 45
	        elseif cam == ("lockplr") then
				Camera.CameraSubject = carSeat
				Camera.CameraType = ("Custom")
				cam = ("car")
				Camera.FieldOfView = 70
	        end
		elseif key == "u" then --Window controls
		 if windows == false then 
			winfob.Visible = true
			windows = true
		 else windows = false
			winfob.Visible = false
		 end
		elseif key == "[" then -- volume down
			if carSeat.Parent.MP.Volume.Value > 0 then
				carSeat.Parent.MP.Volume.Value = carSeat.Parent.MP.Volume.Value - 2
			end
		elseif key == "]" then -- volume up
			if carSeat.Parent.MP.Volume.Value < 20 then
				carSeat.Parent.MP.Volume.Value = carSeat.Parent.MP.Volume.Value + 2
			end	
	end
end)

winfob.FL.Lock.MouseButton1Click:connect(function() --Window
 if carSeat.WindowFL.Value == false then 
  carSeat.WindowFL.Value = true
  carSeat.Parent.Misc.FL.Window.SS.Motor.DesiredAngle = carSeat.Parent.Misc.FL.Window.SS.Motor.DesiredAngle - 0.20
 else carSeat.WindowFL.Value = false
  carSeat.Parent.Misc.FL.Window.SS.Motor.DesiredAngle = carSeat.Parent.Misc.FL.Window.SS.Motor.DesiredAngle + 0.20
 end
end)

winfob.FR.Lock.MouseButton1Click:connect(function() --Window
 if carSeat.WindowFR.Value == false then 
  carSeat.WindowFR.Value = true
  carSeat.Parent.Misc.FR.Window.SS.Motor.DesiredAngle = carSeat.Parent.Misc.FR.Window.SS.Motor.DesiredAngle + 0.20
 else carSeat.WindowFR.Value = false
  carSeat.Parent.Misc.FR.Window.SS.Motor.DesiredAngle = carSeat.Parent.Misc.FR.Window.SS.Motor.DesiredAngle - 0.20
 end
end)

HUB.Limiter.MouseButton1Click:connect(function() --Ignition
 if carSeat.IsOn.Value == false then
	carSeat.IsOn.Value = true
	carSeat.Startup:Play()
	wait(1)
else
	carSeat.IsOn.Value = false
end
end)

TR.SN.MouseButton1Click:connect(function() --Show tracker names
	script.Parent.Names.Value = true
end)

TR.HN.MouseButton1Click:connect(function() --Hide tracker names
	script.Parent.Names.Value = false
end)

carSeat.Indicator.Changed:connect(function()
	if carSeat.Indicator.Value == true then
		script.Parent.Indicator:Play()
	else
		script.Parent.Indicator2:Play()
	end
end)

carSeat.LI.Changed:connect(function()
	if carSeat.LI.Value == true then
		script.Parent.HUB.Left.Visible = true
	else
		script.Parent.HUB.Left.Visible = false
	end
end)

carSeat.RI.Changed:connect(function()
	if carSeat.RI.Value == true then
		script.Parent.HUB.Right.Visible = true
	else
		script.Parent.HUB.Right.Visible = false
	end
end)

HUB.Speed.Eight.MouseButton1Click:connect(function() --1/8
	carSeat.Wait.Value = 8
	carSeat.Parent.Body.Lightbar.Lights.Disabled = false
	HUB.Speed.Eight.BackgroundColor3 = Color3.new(255,0,0)
	HUB.Speed.Four.BackgroundColor3 = Color3.new(0,0,0)
	HUB.Speed.Sixteen.BackgroundColor3 = Color3.new(0,0,0)
	HUB.Speed.Off.BackgroundColor3 = Color3.new(0,0,0)
end)
HUB.Speed.Sixteen.MouseButton1Click:connect(function() --1/16
	carSeat.Wait.Value = 16
	carSeat.Parent.Body.Lightbar.Lights.Disabled = false
	HUB.Speed.Sixteen.BackgroundColor3 = Color3.new(255,0,0)
	HUB.Speed.Eight.BackgroundColor3 = Color3.new(0,0,0)
	HUB.Speed.Four.BackgroundColor3 = Color3.new(0,0,0)
	HUB.Speed.Off.BackgroundColor3 = Color3.new(0,0,0)
end)
HUB.Speed.Four.MouseButton1Click:connect(function() --1/4
	carSeat.Wait.Value = 4
	carSeat.Parent.Body.Lightbar.Lights.Disabled = false
	HUB.Speed.Four.BackgroundColor3 = Color3.new(255,0,0)
	HUB.Speed.Eight.BackgroundColor3 = Color3.new(0,0,0)
	HUB.Speed.Sixteen.BackgroundColor3 = Color3.new(0,0,0)
	HUB.Speed.Off.BackgroundColor3 = Color3.new(0,0,0)
end)
HUB.Speed.Off.MouseButton1Click:connect(function() --Off
	carSeat.Parent.Body.Lightbar.Lights.Disabled = true
	HUB.Speed.Off.BackgroundColor3 = Color3.new(255,0,0)
	HUB.Speed.Eight.BackgroundColor3 = Color3.new(0,0,0)
	HUB.Speed.Sixteen.BackgroundColor3 = Color3.new(0,0,0)
	HUB.Speed.Four.BackgroundColor3 = Color3.new(0,0,0)
end)