This is probably an easy fix, but I keep getting this error 'Attempt to compare number to nil' when obviously i'm NOT comparing anything to 'nil'.
local module = {}
function module:abbreviate(numz)
local num = tonumber(numz)
if num >= 1 and num <= 999 then
return "$"..tostring(num)
end
end
return module
other script:
module = require(Settings)
game.Players.PlayerAdded:connect(function(plr)
local leaderstats = Instance.new("Folder", plr)
leaderstats.Name = 'leaderstats'
local rm = Instance.new("NumberValue", game.Lighting.MoneyStorage)
rm.Name = plr.Name
rm.Value = 0
local money = Instance.new("StringValue", leaderstats)
money.Name = "Cash"
money.Value = "$"..tostring(rm.Value)
rm.Changed:connect(function()
local mtp = rm.Value
local mon = module.abbreviate(mtp)
money.Value = mon
end)
end)

4 comments
What line is the error coming from?
Try changing module:aberviate() to module.abreviate() in the first script.
You need to remove the '$' from mtp in Line 13. Try using: local mtp = string.gsub(rm.Value,"$","")
I figured this before you guys even asked, but the problem was that I put : before instead of a . on line 3 in the modulescript