--workspace.Camera.FieldOfView = 70+((orderch-speed)*10)


if carSeat.Steer ~= 0 and speed > 90 and script.Parent.Active.CC.Value == true then
	b = 0.5
else
	b = 1
end

if (speed*1.07)*0.621371 >= script.Parent.Storage.Limiter.Value + 0.5 then
	xi = 0
else
	xi = 1
end

if speed < 30 then 
	script.Parent.Active.CC.Value = false
end

if script.Parent.Active.CC.Value == true then
	if rpm.Value > 3500 and currentgear.Value ~= script.Parent.Storage.AmountOfGears.Value +2 and carSeat.Storage.Automatic.Value == true then
		script.Parent.Functions.ShiftUpRequested.Value = true
	end
	if (script.Parent.Active.CC.SP.Value*1.07)*0.621371 > script.Parent.Storage.Limiter.Value then
		script.Parent.Active.CC.SP.Value = (script.Parent.Storage.Limiter.Value/1.07)/0.621371
	end
	if speed >= script.Parent.Active.CC.SP.Value then
		xi = 0
	else
		xi = 1
	end
	
	throttle.Value = 1
	if carSeat.Throttle == 1 then
		script.Parent.Active.CC.SP.Value = script.Parent.Active.CC.SP.Value +0.5
	elseif carSeat.Throttle == -1 then
		script.Parent.Active.CC.Value = false
	end
else
	if rpm.Value > redline.Value then
		if script.Parent.Storage.EngineType.Value ~= "Electric" then
	throttle.Value = 1 end
	else
		if script.Parent.Functions.ShiftDownRequested.Value == true or script.Parent.Functions.ShiftUpRequested.Value == true then
			throttle.Value = 0
			else
throttle.Value = TCount
end
end
end

if script.Parent.Storage.EngineType.Value == "Electric" then
	low = 1
	mid = 1
	hi  = 1
	tL = .3*TC
else
	
	if ind.Value == "Natural" then
		low = 1
		mid = 1
		hi  = 1
		
	elseif ind.Value == "Single" then
		if inds.Value >= 0 and inds.Value < 2 then
		low = 1+(.4*(inds.Value))*(boost.Value/1.21)
		mid = 1+(.08*(inds.Value))*(boost.Value/1.21)
		hi  = 1+(.4*(inds.Value))*(boost.Value/1.21)
		
		elseif inds.Value >= 2 and inds.Value < 3 then
		low = 1+(.4*(inds.Value))*(boost.Value/1.21)
		mid = 1+(.08*(inds.Value))*(boost.Value/1.21)
		hi  = 1+(.4*(inds.Value))*(boost.Value/1.21)	
		
		elseif inds.Value >= 3 then
		low = 1+(.4*(inds.Value))*(boost.Value/1.21)
		mid = 1+(.08*(inds.Value))*(boost.Value/1.21)
		hi  = 1+(.4*(inds.Value))*(boost.Value/1.21)
		end
		
	elseif ind.Value == "Twin" then
		low = 1+(.4*(inds.Value))*(boost.Value/1.21)
		mid = 1+(.08*(inds.Value))*(boost.Value/1.21)
		hi  = 1+(.4*(inds.Value))*(boost.Value/1.21)
		
	elseif ind.Value == "Supercharger" then
		low = 1+(.1*(inds.Value))*(boost.Value/1.21)
		mid = 1+(.08*(inds.Value))*(boost.Value/1.21)
		hi  = 1+(.1*(inds.Value))*(boost.Value/1.21)
		end
end

front = (FL.Parent.RotVelocity.Magnitude+FR.Parent.RotVelocity.Magnitude)/2
back = (RL.Parent.RotVelocity.Magnitude+RR.Parent.RotVelocity.Magnitude)/2
average = (front + back)/2

if carSeat.Storage.TC.Value == true then
	if (1.4-(front + 0)/(average + 5)) < 0.6 then
		ft = (1.4-(front + 0)/(average + 5))
		
	elseif (1.4-(back + 0)/(average + 5)) < 0.6 then
		rt = (1.4-(back + 0)/(average + 5))
		
	else
		ft = 1
		rt = 1
	end
else
	ft = 1
		rt = 1
end