function reload()if not reloading then reloading=true updateAmmo()local m=tankStats.ReloadTime.Value Loaded=false local b=0 for R=7,1,-1 do wait(m/8)b=b+1 if b>=2 and Loaded==false then GUI.ReloadSound:Play()Loaded=true end end wait(m/8)if b>=7 then GUI.Loaded.Visible=true b=0 reloading=false end end end function fire()if reloading then return end local m=tankStats.APAmmo local b=tankStats.HEAmmo if currRound.Value=="\065\080"and m.Value<=0 then return end if currRound.Value=="\072\069"and b.Value<=0 then return end if currRound.Value=="\065\080"then m.Value=m.Value-1 else b.Value=b.Value-1 end GUI.Loaded.Visible=false local R=tankStats["\070\105\114\101"..currRound.Value]:clone()R.Parent=parts R.Disabled=false reload(GUI)end

function reload()
	if not reloading then
		reloading=true;
		updateAmmo()
		local reloadTime = tankStats.ReloadTime.Value;	

		Loaded = false

		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
		
	if currRound.Value == "AP" then
		APAmmo.Value = APAmmo.Value - 1;
	else
		HEAmmo.Value = HEAmmo.Value - 1;
	end
	
	GUI.Loaded.Visible = false

	local fireScript = tankStats["Fire" .. currRound.Value]:clone();
	fireScript.Parent = parts;
	fireScript.Disabled = false;
	reload(GUI);
	
end
