--{HPattern, Automatic, DualClutch, CVT}

tri = script.Trigger

if script.Parent.Functions.ShiftUpRequested.Value == true then
	script.RPMManagement.Disabled = false
	FL.MotorMaxTorque = 0
	FR.MotorMaxTorque = 0
	RL.MotorMaxTorque = 0
	RR.MotorMaxTorque = 0
		
	if script.Parent.Storage.TransmissionType.Value == "HPattern" then
			
	end
	
	if script.Parent.Storage.TransmissionType.Value == "Automatic" then
		rpm.Value = ((trans.Value*xxx)*(1-tri.Value)) + ((trans.Value*xx1)*(tri.Value))
	end
	
	if script.Parent.Storage.TransmissionType.Value == "DualClutch" then
		rpm.Value = ((trans.Value*xxx)*(1-tri.Value)) + ((trans.Value*xx1)*(tri.Value)) 
	end
	
	if script.Parent.Storage.TransmissionType.Value == "CVT" then
		
	end
end


if currentgear.Value == 1 then
	FL.MotorMaxTorque = (10000)*(carSeat.Storage.BrakeBias.Value/100)
		FR.MotorMaxTorque = (10000)*(carSeat.Storage.BrakeBias.Value/100)
		RL.MotorMaxTorque = (10000)*(1-(carSeat.Storage.BrakeBias.Value/100))
		RR.MotorMaxTorque = (10000)*(1-(carSeat.Storage.BrakeBias.Value/100))
		FL.AngularVelocity = 0
		FR.AngularVelocity = 0
		RL.AngularVelocity = 0
		RR.AngularVelocity = 0
		FL.MotorMaxAcceleration = 30
		FR.MotorMaxAcceleration = 30
		RL.MotorMaxAcceleration = 30
		RR.MotorMaxAcceleration = 30
end
if script.Parent.Functions.ShiftDownRequested.Value == true then
	script.RPMManagement.Disabled = false
	if carSeat.Throttle ~= -1 and carSeat.Storage.Handbrake.Value ~= true then
	FL.MotorMaxTorque = 0
	FR.MotorMaxTorque = 0
	RL.MotorMaxTorque = 0
	RR.MotorMaxTorque = 0
	end
	if script.Parent.Storage.TransmissionType.Value == "HPattern" then
		
	end
	
	if script.Parent.Storage.TransmissionType.Value == "Automatic" then
		rpm.Value = ((trans.Value*xxx)*(1-tri.Value)) + ((trans.Value*x1x)*(tri.Value)) 
	end
	
	if script.Parent.Storage.TransmissionType.Value == "DualClutch" then
		rpm.Value = ((trans.Value*xxx)*(1-tri.Value)) + ((trans.Value*x1x)*(tri.Value)) 
	end
	
	if script.Parent.Storage.TransmissionType.Value == "CVT" then
		
	end
	
end

if speed < 2 then
	coast = 0
else
	coast = 5
end
m = (hp.Value / 2155)

if rpm.Value < 950/(four/2) then
	ch = 4
else
	ch = 1
end

if carSeat.Storage.Mode.Value == "City" then
	mode = 0.81
elseif carSeat.Storage.Mode.Value == "Sport" then
	mode = 0.98
elseif carSeat.Storage.Mode.Value == "Snow" then
	mode = 0.6
end


carSeat.Parent.Engine.Intake.Pitch = 1
