#global leaderboard caps at 9.2Qn

259 messages · Page 1 of 1 (latest)

pastel hollow
#

so i'm using a model since i've tried multiple youtube tutorials for global leaderboards myself which all didn't work and it seems to work fine and all but unfortunately the amount caps at 9.2Qn meanwhile the value is way more than that.

#

script:


local statsName = "Cash"
local maxItems = 100
local minValueDisplay = 1
local maxValueDisplay = 10e30
local abbreviateValue = true
local updateEvery = 10
local headingColor = Color3.fromRGB(160, 95, 53)

local DataStoreService = game:GetService("DataStoreService")
local Players = game:GetService("Players")
local DataStore = DataStoreService:GetOrderedDataStore("CashLeaderboard_" .. statsName)
local Frame = script.Parent.Frame
local Contents = Frame.Contents
local Template = script.objTemplate

local COLORS = {
    Default = Color3.fromRGB(38, 50, 56),
    Gold = Color3.fromRGB(255, 215, 0),
    Silver = Color3.fromRGB(192, 192, 192),
    Bronze = Color3.fromRGB(205, 127, 50)
}
local ABBREVIATIONS = {
    "k";
    "M";
    "B";
    "T";
    "Qd";
    "Qn";
    "Sx";
    "Sp";
    "Oc";
    "No";
    "De";
    "UDe";
    "DDe";
    "TDe";
    "QdDe";
    "QnDe";
    "SxDe";
    "SpDe";
    "OcDe";
    "NoDe";
    "Vt";
    "UVt";
    "DVt";
    "TVt";
    "QdVt";
    "QnVt";
    "SxVt";
    "SpVt";
    "OcVt";
    "NoVt";
}
local function toHumanReadableNumber(num)
    if num < 1000 then
        return tostring(num)
    end
    
    local digits = math.floor(math.log10(num)) + 1
    local index = math.min(#ABBREVIATIONS, math.floor((digits - 1) / 3))
    local front = num / math.pow(10, index * 3)
    print("toHumanReadableNumber", num, #ABBREVIATIONS, index, front)
    return string.format("%i%s+", front, ABBREVIATIONS[index])
end```
#
    local data = DataStore:GetSortedAsync(false, maxItems, minValueDisplay, maxValueDisplay)
    local topPage = data:GetCurrentPage()

    Contents.Items.Nothing.Visible = #topPage == 0 and true or false

    for position, v in ipairs(topPage) do
        local userId = v.key
        local value = v.value
        local username = "[Not Available]"
        local color = COLORS.Default

        local success, err = pcall(function()
            username = Players:GetNameFromUserIdAsync(userId)
        end)

        if position == 1 then
            color = COLORS.Gold
        elseif position == 2 then
            color = COLORS.Silver
        elseif position == 3 then
            color = COLORS.Bronze
        end

        local item = Template:Clone()
        item.Name = username
        item.LayoutOrder = position
        item.BackgroundTransparency = 1
        item.DropShadow.Visible = false
        item.Values.Number.TextColor3 = color
        item.Values.Number.Text = position
        item.Values.Username.Text = username
        item.Values.Value.Text = abbreviateValue and toHumanReadableNumber(value) or value
        item.Parent = Contents.Items
    end
end```
#
Frame.Heading.ImageColor3 = headingColor
Frame.Heading.Bar.BackgroundColor3 = headingColor

while true do
    for _, player in pairs(Players:GetPlayers()) do
        local Stats = player:FindFirstChild("Stats")

        if not Stats then
            warn("Couldn't find Stats!")
            break
        end

        local statsValue = Stats:FindFirstChild(statsName)

        if not statsValue then
            warn("Couldn't find " .. statsName .. " in Stats!")
            break
        end

        pcall(function()
            DataStore:UpdateAsync(player.UserId, function()
                return tonumber(statsValue.Value)
            end)
        end)
    end

    for _, item in pairs(Contents.Items:GetChildren()) do
        if item:IsA("Frame") then
            item:Destroy()
        end
    end

    getItems()

    wait()
    Frame.Heading.Heading.Text = statsName .. " Leaderboard"
    Contents.GuideTopBar.Value.Text = statsName
    wait(updateEvery)
end```
sharp elbow
pastel hollow
sharp elbow
#

so what ever it is since a IntValue Stops at 1e64
NumberValue stops at 1e308
DoubleConstrainedValue starts at 0
minValue is 0 if u want to
maxValue is as much as u want it to be

pastel hollow
#

thats really confusing for me i dont know what u mean by that

vague torrentBOT
#

studio** You are now Level 3! **studio

sharp elbow
#

so which part makes it stop at 9.2Qn

pastel hollow
sharp elbow
#

lol im fixing some it but its going to take like a minute or 2

pastel hollow
#

alright take your time

thick geode
#

use formatted number

pastel hollow
sharp elbow
thick geode
#

Give me a sec

#
#

Ups

#

that link was not

sharp elbow
thick geode
#

@pastel hollow with this you will avoid many headaches

pastel hollow
thick geode
sharp elbow
thick geode
#

And a video in case you don't understand

sharp elbow
#

lol

pastel hollow
thick geode
#

Xd

sharp elbow
# pastel hollow i tried the script it still says the same

well here is a much more simple version without doing Player Data stuff

function Divide(num, num1)
    return num / num1
end

function Add(num, num1)
    return num + num1
end

function Convert(num)
    local Suffix = {'', 'K', 'M', 'B'}
    local Suffix_Index = 1
    while num >= 1000 and Suffix_Index < #Suffix do
        num = Divide(num, 1000)
        Suffix_Index = Add(Suffix_Index, 1)
    end
    return string.format('%.2f', num) .. Suffix[Suffix_Index]
end

local Value = 10000
local TextLabel = script.Parent.TextLabel
while true do
    TextLabel.Text = Convert(Value)
    task.wait()
end```
stone radish
#

Alright

#

or

#

this happend to me before

vague torrentBOT
#

studio** You are now Level 15! **studio

stone radish
#

let me read this

#

yeah sometimes it doesnt work even if you go to the toolbox and get a free model just try to understand it more

#

idk if the script above this worked if it doesnt ping me i can try to help

#

since leaderboards are a little conufsing sometimes

stone radish
#

Alright

#

so

#

the leaderboard

#

i have the same one as you

#

i just dont feeel like fixing it

#

but ik whats wrong LOL

sharp elbow
stone radish
#

dont know

#

but

#

it caps at 9.2qn

#

which is

#

a lot of 0's

#

so i wont write that out

pastel hollow
#

yes

stone radish
#

BUT

#

thats the cap for int

#

so your currency

#

is a num value right

pastel hollow
#

yeah

stone radish
#

okay so

#

what ima do with you actly

#

is change the max number

#

at the top that says like 10e__

#

change that around to a low number

#

and see if ti works first

#

it*

#

like make it 5

#

and see if the script actually will work with a lower number

pastel hollow
#

well i mean it works but everyone above it dissapears

#

disappears

stone radish
#

ok

#

good

#

its fine if it does that

#

So now we know the script works

#

now we go into debugging

#

change it back

#

to a number u want

pastel hollow
#

okay

stone radish
#

like 10e60 or whatever it was at

#

Now

#

I have another abbreviating script

#

let me get it rq

sharp elbow
stone radish
#

Im trying it rn

sharp elbow
#

on that i made that goes to 1OcDc

stone radish
#

just also

#

use another leaderboard

#

this thing is crappy anyway

#

u can make a ebtter one

pastel hollow
#

okay

#

like the script?

stone radish
#

yeah

#

its bad

#

click on that

stone radish
pastel hollow
#

i need u to help me with another one though bc ive tried multiple tutorials

stone radish
#

get that

#

its a model

pastel hollow
#

i got it

stone radish
#

scientific notaton

#

which is this

#

its lik 10^6

#

thats scientific notation

sharp elbow
#

but the one i have does both Converting

#

so the First one is 1e3 aka Notation
while the other is to convert Notation to Suffix

stone radish
#

yeah

#

I have that i believe aswell

#

dont know

sharp elbow
#

so its both in one

#

the math of the Exponents took a while

stone radish
#

true

sharp elbow
#

because each one was from 0 to 308

pastel hollow
#

now what do i do with that model

sharp elbow
#

just put it inside ReplicatedStorage

pastel hollow
#

i put them all in the things they should be

sharp elbow
#

lol its just one thing

pastel hollow
#

oh

#

uhm

#

can i just delete the screengui?

#

and do i delete the test script?

sharp elbow
#

ye that was a example thing i did so people understand the system

pastel hollow
#

wait

#

does this like take effect on all numbervalues?

stone radish
#

now im not gonna use it cus i allrdy have a system

#

but

#

when youre saving HUGE number

#

s

#

its really nice to have

stone radish
#

since its less prone to errors and crashes

#

and more

#

and data loss

sharp elbow
stone radish
#

kindaaaa

#

a different system

#

not like that

#

i can make my own

pastel hollow
#

i put like the same abbreviation script in every single part i need them values for

#

what do i do now for the leaderboard?

stone radish
#

I have that aswell

sharp elbow
#

oh lol i can give a Exponent BigNum but im still fixing the bugs

stone radish
#

LOL

#

rip

sharp elbow
#

its just only one part that is just to confusing like after i do the 1000De aka Ude but it converts to 1e36 then after that is 1e39
but once it reaches 1e999 it should convert to 1e1.00k
but still trying to do that part aka 1e1.00k

pastel hollow
#

can u help me

#

how do i apply those abbreviations to like every text i need it for

sharp elbow
#

so each text is ```lua
local Notation = require(game.ReplicatedStorage.SNotation)

#

then u can either create a LocalScript to handle all the Text or just into each Text

#

so is it short for the second function

#

so u can create a function to handle all the Textlua function UpdateText() while task.wait() do local x = Notation.short(num.Value) -- num is a example local x1 = Notation.short(num1.Value) TextLabel.Text = 'Coins: '..x TextLabel1.Text = 'Multi: '..x1 end end task.spawn(UpdateText)

pastel hollow
#

wait is it true that qd is 15 and qn is 17?

#

and thx btw

sharp elbow
#

yes so 0 is 0 then 3 is k then 6 is M

#

and so on

pastel hollow
#

why is the difference between qd and qn 2 and everything is 3

sharp elbow
#

9 is B 12 is T 15 is Qd 17 is Qn 20 is Sx 23 is Sp 26 is Oc 29 is No

pastel hollow
#

okay

sharp elbow
#

at one point i messed up on the exponent to the suffix which took me like 3 times to look over and redo the numbers
and then refix each suffix

pastel hollow
#

ah

vague torrentBOT
#

studio** You are now Level 4! **studio

pastel hollow
#

btw what if i want there to be numbers after the decimal

sharp elbow
#

so u see the lua return string.format('%.0f')

pastel hollow
#

yes

sharp elbow
#

if it sayslua if number > 1000 then return string.format('%.0f',number)..suffixes[suffix_index] else return string.format('%.2f',number)..suffixes[suffix_index] end

#

a example but forgot what i put

#

so %.0f means 0 decimals if its like at 100
it just shows 100
then %.2f means 2 decimals just the same
but its 100.00
and not as 100
so if its over 1k it shows 1.00k instead of 1k

pastel hollow
#

ah okay

#

thank you

sharp elbow
#

ye

pastel hollow
#

uhm so i see 0M or 0K how do i fix that

sharp elbow
#

sometimes it does that

pastel hollow
#

can i fix that?

sharp elbow
#

dont know can u lol
but i dont know since i havent touched that script like about a month so i dont know

stone radish
#

ok

#

let me see

#

@pastel hollow

#

whats the problem now

sharp elbow
#

im hop on the the original to see what to fix

stone radish
#

alr

pastel hollow
#

i fixed it

#

but i just need help to make a whole new leaderboard script

stone radish
#

ok

#

just get a diff model or watch a tutorial

pastel hollow
#

can u recommend one

sharp elbow
#

well thats odd for me its showing this

stone radish
#

noah

pastel hollow
stone radish
#

go to toolbox and search one up if u dont wanna watch a tutoprial

#

tutorial

stone radish
#

his old one

#

was from the toolbox

#

even IM USING IT

#

its good

#

but

#

its conufsing

#

thats why u shouldnt use it

#

just make one

sharp elbow
#

oh the Reason is because its in exponent form not Number form

pastel hollow
pastel hollow
sharp elbow
#

lol

stone radish
#

i didnt

#

LMAO

#

that leaderboards weird

#

i dont use it

#

you can make one

#

they aint hard to make

sharp elbow
#

here is something that has a BigNum

sharp elbow
#

and some modules that i made

#

so lets see 2 is what 100

stone radish
#

also how the hell do i do this

#

CommonEgg.chooseRandomPet = function(egg)
local randomNumber = math.random(1,10000)
print(randomNumber)
local counter = 0
for rarity, weight in pairs(egg["Rarities"]) do
counter = counter + weight
if randomNumber <= counter then

        local rarityTable = egg["Pets"][rarity]
        local chosenPet = rarityTable[math.random(1, #rarityTable)]
        
        return chosenPet
    end
end

end

#

sorry i didnt format but

#

egg aint nil

#

and i cant do egg.Rarities yet it exists under CommonEgg.rarities

#

whateva

pastel hollow
#

can u guys help me @stone radish @sharp elbow

#
local sample = script:WaitForChild("objTemplate")
local sf = sg.Frame.Contents:WaitForChild("Items")
local ui = sf:WaitForChild("UIListLayout")

local dataStoreService = game:GetService("DataStoreService")

local dataStore = dataStoreService:GetOrderedDataStore("Stats")

wait(10)
while true do
    for i, plr in pairs(game.Players:GetChildren()) do
        if plr.UserId>0 then
            local ps = game:GetService("PointsService")
            local w = plr.Stats.Cash.Value
            if w then
                pcall(function()
                    
                    dataStore:UpdateAsync(plr.UserId,function(oldVal)
                        
                        return tonumber(w)
                    end)
                end)
            end
        end
    end```
#
    local numberToShow = 100
    local minValue = 1
    local maxValue = 10e30
    local pages = dataStore:GetSortedAsync(smallestFirst, numberToShow, minValue, maxValue)
    
    local top = pages:GetCurrentPage()
    local data = {}
    for a,b in ipairs(top) do
        local userid = b.key
        local points = b.value
        local username = "Failed to load"
        local s,e = pcall(function()
            username = game.Players:GetNameFromUserIdAsync(userid)
        end)
        if not s then
            warn("Error getting name from"..userid..". Error: "..e)
        end
        
        table.insert(data,{username,points})
    end
    ui.Parent = script
    sf:ClearAllChildren()
    ui.Parent = sf
    for number,d in pairs(data) do
        local name = d[1]
        local val = d[2]
        local rank = d[3]
        local color = Color3.new(0.32549, 0.32549, 0.32549)
        if number == 1 then
            color = Color3.new(1, 1, 0)
        elseif number == 2 then
            color = Color3.new(0.9,0.9,0.9)
        elseif number == 3 then
            color = Color3.new(116,112,0)
        end
        local new = sample:Clone()
        new.Name = name
        new.LayoutOrder = number
        new.Values.Number = number
        new.Values.Username.Text = name
        new.Values.Value.Text = val
        new.Values.Number.TextColor3 = color
        new.Parent = sf
    end
    wait()
    sf.CanvasSize = UDim2.new(0,0,0,ui.AbsoluteContentSize.Y)
    
    wait(10)
end```
#

i really need help with a leaderboard script

pastel hollow
#

i give up bro

thick geode
#

what is the problem?@pastel hollow

pastel hollow
#

and i don't know how to make a new leaderboard

stone radish
#

DOG

#

get a free model

#

if you cant watch a tutorial

pastel hollow
#

which one

strong latch
strong latch
thick geode
#

or watch a tutorial spanishkek

stone radish
#

no

#

dont do any of those if it takes 3 hours

#

and u said u dont watch any tutorials

#

try to get help here

#

cus its been 5 hours

#

where u couldve learned it in 10 mins

sharp elbow
sharp elbow
stone radish
#

He’s new rbi

#

Tho

sharp elbow
#

@civic flicker how to make that script

pastel hollow
pastel hollow
#

Can you guys help me?

stone radish
#

Dog it’s been a day

#

They do work

#

The leaderboard tutorials

#

Or just get a free model

#

Less then twenty mins

pastel hollow
#

which tutorial or model do u recommend

pastel hollow
#

its saying an error now ive tried making a script

pastel hollow
#

the error is saying Players:GetUserIdFromNameAsync() failed: Unknown user

#

the script i got atm is: ```local DSS = game:GetService("DataStoreService")
local ODS = DSS:GetOrderedDataStore("Cash")
local stat = script.Parent.Stats
local Template = game:GetService("ServerStorage"):WaitForChild("Template")

local cooldown = 10

local function updateBoard()
local data = ODS:GetSortedAsync(false, 10)
local page = data:GetCurrentPage()

for i, v in ipairs(page) do
    local name = game:GetService("Players"):GetNameFromUserIdAsync(v.key)
    local cash = v.value
    local rank = i
    local onBoard = false
    local notation = require(game.ReplicatedStorage.SNotation)
    
    for i, v in pairs(stat:GetChildren()) do
        if v:IsA("UIListLayout") then continue end
        
        if v.Name == name then
            onBoard = true
        end
    end
    
    if cash and not onBoard then
        local temp = Template:Clone()
        temp.Name = name
        temp.Username.Text = name
        temp.Rank.Text = rank
        temp.Value.Text = notation.short(cash)
        temp.Parent = stat
        temp.LayoutOrder = rank
        
        if rank == 1 then
            temp.Rank.TextColor3 = Color3.fromRGB(255, 255, 55)
        elseif rank == 2 then
            temp.Rank.TextColor3 = Color3.fromRGB(180, 180, 180)
        elseif rank == 3 then
            temp.Rank.TextColor3 = Color3.fromRGB(170, 103, 37)
        end
        
    end
end

end

while true do
for i, v in ipairs(game:GetService("Players"):GetPlayers()) do
ODS:SetAsync(v.UserId, v.Stats.Cash.Value)

end
for i, v in pairs(stat:GetChildren()) do
    if v:IsA("UIListLayout") then continue end
    
    v:Destroy()
end

updateBoard()
task.wait(cooldown)

end```