-------------------------
 
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 == "n" 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)
 
winfob.RL.Lock.MouseButton1Click:connect(function() --Window
 if carSeat.WindowRL.Value == false then 
  carSeat.WindowRL.Value = true
  carSeat.Parent.Misc.RL.Window.SS.Motor.DesiredAngle = carSeat.Parent.Misc.RL.Window.SS.Motor.DesiredAngle - 0.20
 else carSeat.WindowRL.Value = false
  carSeat.Parent.Misc.RL.Window.SS.Motor.DesiredAngle = carSeat.Parent.Misc.RL.Window.SS.Motor.DesiredAngle + 0.20
 end
end)

winfob.RR.Lock.MouseButton1Click:connect(function() --Window
 if carSeat.WindowRR.Value == false then 
  carSeat.WindowRR.Value = true
  carSeat.Parent.Misc.RR.Window.SS.Motor.DesiredAngle = carSeat.Parent.Misc.RR.Window.SS.Motor.DesiredAngle + 0.20
 else carSeat.WindowRR.Value = false
  carSeat.Parent.Misc.RR.Window.SS.Motor.DesiredAngle = carSeat.Parent.Misc.RR.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
		carSeat.Parent.Body.Dash.D.G.Info.Left.Visible = true
		script.Parent.HUB.Left.Visible = true
	else
		carSeat.Parent.Body.Dash.D.G.Info.Left.Visible = false
		script.Parent.HUB.Left.Visible = false
	end
end)

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


while wait() do
	carSeat.Parent.Body.Dash.D.G.Info.Time.Text = game.Lighting.TimeOfDay
	carSeat.Parent.Body.Dash.T.G.Time.Text = game.Lighting.TimeOfDay
	carSeat.Parent.Body.Dash.D.G.Info.Speed.Text = math.floor(carSeat.Velocity.magnitude*((10/12) * (60/88)))
	if game.ReplicatedStorage:FindFirstChild("WeatherResources") ~= nil then
		carSeat.Parent.Body.Dash.S.G.Temperature.Text = game.ReplicatedStorage.WeatherResources.Weather.Current.Temperature.Value
		carSeat.Parent.Body.Dash.S.G.Weather.Text = game.ReplicatedStorage.WeatherResources.Weather.Current.Weather.Value
	elseif game.ReplicatedStorage:FindFirstChild("WeatherResources") == nil then
		carSeat.Parent.Body.Dash.S.G.Temperature.Text = ":("
		carSeat.Parent.Body.Dash.S.G.Weather.Text = "TTP Plugin not found"
	end
end