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

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/8);


		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
