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