function onKeyDown(n)if n==nil then return end n=n:lower()if n=="\099"then if firingMg then return end firingMg=true while firingMg do if not fireCoax()then firingMg=false wait()end updateAmmo()end end if n=="\102"then if tankStats.Round.Value=="\065\080"then tankStats.Round.Value="\072\069"else tankStats.Round.Value="\065\080"end updateAmmo()end if n=="\101"then parts.Engine.BodyGyro.MaxTorque=Vector3.new(0,0,100)print("\070\108\105\112\112\105\110\103 \086\101\104\105\099\108\101")wait(5)parts.Engine.BodyGyro.MaxTorque=Vector3.new(0,0,0)end if n=="\113"then if braking then return end braking=true while braking do if not Brakes()then braking=false end updateAmmo()end end end
-- When key pressed
function onKeyDown(key)
	if key == nil then
		return
	end
	key = key:lower()

	-- Coaxial Machine Gun Control
	if key == "c" then
		if firingMg then
			return
		end

		firingMg = true

		while firingMg do
			if not fireCoax() then
				firingMg = false
				wait()
			end
			updateAmmo()
		end
	end

	if key == "f" then
		if tankStats.Round.Value == "AP" then
			tankStats.Round.Value = "HE"
		else
			tankStats.Round.Value = "AP"
		end
		updateAmmo()
	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
