Roblox auto-reloading sometimes on 1 bullet?

Hey. I created an auto reload when a weapon reaches 1 bullet, but for some reason, it sometime applies on 1 bullet. Here is my code:

while wait(info.Rate) do
	if isShooting and not script.Parent.Configuration.IsOnSafe.Value and not script.Parent.Configuration.IsReloading.Value and script.Parent.Ammo.Value ~= 0 then
		script.Parent.Ammo.Value = script.Parent.Ammo.Value - 1
		local sound = script.Shoot:Clone();
		sound.Parent = script.Parent.Handle;
		sound:Play()
	elseif script.Parent.Ammo.Value == 0 and not script.Parent.Configuration.IsReloading.Value and isShooting and script.Parent.Ammo.Value ~= script.Parent.MaxAmmo.Value then
		local isReloading = script.Parent.Configuration.IsReloading;
		local player = game.Players:GetPlayerFromCharacter(script.Parent.Parent);
		if player.Character:FindFirstChildOfClass("Humanoid").Health == 0 then return end;
		player:WaitForChild("PlayerGui"):WaitForChild("Weapon").IsReloading.Value = true
		isReloading.Value = true
		local animation = reload;
		track2 = player.Character.Humanoid:LoadAnimation(animation);
		track2:Play(0.100000001, 1, info.ReloadSpeed)
		script.Parent.Handle.Reload:Play()
		wait(2 / info.ReloadSpeed + .5)
		player:WaitForChild("PlayerGui"):WaitForChild("Weapon").IsReloading.Value = false
		if script.Parent.Parent:FindFirstChild("Humanoid") then
			script.Parent.Ammo.Value = info.MaxAmmo
			track:Play()
			isReloading.Value = false
		else
			isReloading.Value = false
		end
	end
end

Have you tried putting prints in to confirm your logic is flowing as you expect?