What is wrong with this abbreviation script?

  1. What do you want to achieve? I want this abbreviation script to work with my string value leaderstats

  2. What is the issue? I keep on getting an error when it compares it to a number

I’ve tried to ask some friends about it, and checked dev forum, but i didn’t find any information

-- This is an example Lua code block

local function shorten(Input)
	local Negative = Input < 0
	Input = math.abs(Input)
	
	local Paired = false
	for i,v in pairs(MoneyLib.Suffixes) do
		if not (Input >= 10^(3*i)) then
			Input = Input / 10^(3*(i-1))
			local isComplex = (string.find(tostring(Input),".") and string.sub(tostring(Input),4,4) ~= ".")
			Input = string.sub(tostring(Input),1,(isComplex and 4) or 3) .. (MoneyLib.Suffixes[i-1] or "")
			Paired = true
			break;
		end
	end



Thanks for reading🙂
1 Like

Can you show us which one line 94 is?

2 Likes

Yes i can

1 Like

Looks like it could be local Negative = Input < 0 as that’ the only “compare”. Just do:

local Negative = tonumber(Input) < 0

This is a bigger issue if “Input” isn’t a number.

2 Likes

Thank you so much, Im a dumb lol

Now i just need to figure out another one of my problems

3 Likes

Happy to help, feel free to drop it here. I’m just in a meeting.

2 Likes