function reload()if not reloading then reloading=true updateAmmo()local Q=tankStats.ReloadTime.Value local B=0 for Z=7,1,-1 do wait(Q/8)B=B+1 if B>=2 and Loaded==false then GUI.ReloadSound:Play()Loaded=true end end wait(Q/4)if B>=7 then GUI.Loaded.Visible=true B=0 reloading=false end end end function fire()if reloading then return end local Q=tankStats.APAmmo local B=tankStats.HEAmmo if currRound.Value=="\065\080"and Q.Value<=0 then return end if currRound.Value=="\072\069"and B.Value<=0 then return end GUI.Loaded.Visible=false TFE:FireServer("\070\105\114\101",parts,currRound,Q,B,tankStats)reload(GUI)end
-- Reload animation
function reload()
	if not reloading then
		reloading = true
		updateAmmo()
		local reloadTime = tankStats.ReloadTime.Value

		local Timer = 0

		for i = 7, 1, -1 do
			wait(reloadTime / 8)
			Timer = Timer + 1

			if Timer >= 2 and Loaded == false then
				GUI.ReloadSound:Play()
				Loaded = true
			end
		end
		wait(reloadTime / 4)

		if Timer >= 7 then
			GUI.Loaded.Visible = true

			Timer = 0
			reloading = false
		end
	end
end

function fire()
	if reloading then
		return
	end
	local APAmmo = tankStats.APAmmo
	local HEAmmo = tankStats.HEAmmo
	if currRound.Value == "AP" and APAmmo.Value <= 0 then
		return
	end
	if currRound.Value == "HE" and HEAmmo.Value <= 0 then
		return
	end
	GUI.Loaded.Visible = false

	TFE:FireServer("Fire", parts, currRound, APAmmo, HEAmmo, tankStats)

	reload(GUI)
end
