Attempt to perform arithmetic (pow) on number and nil?

I am trying to format a number to a readable stance. Here is what I have

FormatCounter ModuleScript (This works with everything else except the PopupHandler script):

local module = {}

local abbreviations = {"", "K", "M", "B", "T", "Qa", "Qi", "Sx", "Sp"}

function module.Format(value, idp)
	local ex = math.floor(math.log(math.max(1, math.abs(value)), 1000))
	local abbrevs = abbreviations[1 + ex] or ("e+"..ex)
	local normal = math.floor(value * ((10 ^ idp) / (1000 ^ ex))) / (10 ^ idp)

	return("%."..idp.."f%s"):format(normal, abbrevs)
end

return module

PopupHandler:

local FormatCounter = require(game.ReplicatedStorage:WaitForChild("FormatCounter"))
wait(2)

click = 0
local plr = game.Players.LocalPlayer
while wait() do
	if click ~= plr.leaderstats.Taps.Value then
		local random = math.random(1, 900)
		local xnew = random / 1000
		local new = game.ReplicatedStorage.ShowAdd:Clone()
		
		new.Parent = script.Parent.PopupGui
		new.Position = UDim2.new(xnew, 0, 1, 0)
		new.Text = "+"..FormatCounter.Format(plr.leaderstats.Taps.Value) - click.." Taps"
		
		click = plr.leaderstats.Taps.Value
	end
end

Any help will be appreciated

Thanks

-GreenTreeGamingYT

function module.Format(value, idp)
FormatCounter.Format(plr.leaderstats.Taps.Value)

The function has two required parameters, you call it with a single argument.

Adding on to what @Forummer said. You forgot to pass the idp through the function, the idp in your case is the number of decimals after the number (example: the idp is 3, 1.074M. If the idp is 2. 1.07M)

I am now getting this error: Players.GreenTreeGamingYT.PlayerGui.PopupHandler:14: attempt to perform arithmetic (sub) on string and number

local FormatCounter = require(game.ReplicatedStorage:WaitForChild("FormatCounter"))
wait(2)

click = 0
local plr = game.Players.LocalPlayer
while wait() do
	if click ~= plr.leaderstats.Taps.Value then
		local random = math.random(1, 900)
		local xnew = random / 1000
		local new = game.ReplicatedStorage.ShowAdd:Clone()
		
		new.Parent = script.Parent.PopupGui
		new.Position = UDim2.new(xnew, 0, 1, 0)
		new.Text = "+"..FormatCounter.Format(plr.leaderstats.Taps.Value, 0) - click.." Taps"
		
		click = plr.leaderstats.Taps.Value
	end
end

This is what’s causing your error. The formatted number is a string, you can’t subtract a number from that.