local Abbreviations = {
"";
"K";
"M";
"B";
"T";
"Q";
"Qx";
"Sx";
"Sp";
"Oc";
"N";
"D";
"∞";
}
local function AbbreviateNumber(Number)
for i = 1, #Abbreviations do
if Number < 10 ^ (i * 3) then
if Abbreviations[i] == "∞" then
return "∞"
else
return math.floor(Number / ((10 ^ ((i-1) * 3)) / 100)) / (100) .. Abbreviations[i]
end
elseif tostring(Number) == "inf" then
return "∞"
end
end
end
while wait() do
local Player = game.Players.LocalPlayer
script.Parent.Text.Text = "🍬 Candy: "..AbbreviateNumber(1000000000000000000000000000000000000000) -- Placeholder number
end
your trying to join the number (1000000000000000000000000000000000000000) and nil, which is returned by the abbreviatenumber function. So, your problem is lying in the abbreviatenumber function. To debug, try replacing this line before any return's in your code, replace:
local function AbbreviateNumber(Number)
print("Test 1")
for i = 1, #Abbreviations do
print("Test 2")
if Number < 10 ^ (i * 3) then
print("Test 3")
if Abbreviations[i] == "∞" then
print("Test 4")
return "∞"
else
return math.floor(Number / ((10 ^ ((i-1) * 3)) / 100)) / (100) .. Abbreviations[i]
end
elseif tostring(Number) == "inf" then
return "∞"
end
end
end
This is the part that is giving error, try focusing on this and maybe you will find the solution.
What I mean was, try to remove that.
local Player = game.Players.LocalPlayer
script.Parent.Text.Text = "🍬 Candy: "..AbbreviateNumber(1000000000000000000000000000000000000000) -- Placeholder number
I’m not really sure what you mean as that number was a placeholder to see if it would work if the value was that. This is the actual code.
while wait() do
local Player = game.Players.LocalPlayer
script.Parent.Text.Text = "🍬 Candy: "..AbbreviateNumber(Player:WaitForChild("leaderstats"):WaitForChild("🍬 Candy").Value)
end