-- When key pressed

function onKeyDown(key)
	if key == nil then return end
	key = key:lower()
			
	-- Coaxial Machine Gun Control
	if key == 'f' then
		if firingMg then return end
			
		firingMg = true;
			
		while firingMg do
			if not fireCoax() then
				firingMg = false;
			wait()
			end
			updateAmmo();
		end	
	end
	
	-- Switch ammo type
	if key == 'e' then
		parts.Engine.BodyGyro.MaxTorque = Vector3.new(0,0,100)
		print("Flipping Vehicle")
		wait(5)
		parts.Engine.BodyGyro.MaxTorque = Vector3.new(0,0,0)
	end
	if key == 'q' then
		if braking then return end
			
		braking = true;
			
		while braking do
			if not Brakes() then
				braking = false;
			end
			updateAmmo();
		end	
	end
end
