-- Reload animation

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
