#global leaderboard caps at 9.2Qn
259 messages · Page 1 of 1 (latest)
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```
oh change it to a NumberValue and
numbervalue? what do i change to a numbervalue?
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
thats really confusing for me i dont know what u mean by that
** You are now Level 3! **
so which part makes it stop at 9.2Qn
i don't know i just did print("toHumanReadableNumber", num, #ABBREVIATIONS, index, front) and it stops at 9.2Qn somewhere even though the amount of Cash (numbervalue) i got is 800Oc
lol im fixing some it but its going to take like a minute or 2
alright take your time
use formatted number
what do you mean?
its been a while
Give me a sec
Ups
that link was not
here is the Updated Script
@pastel hollow with this you will avoid many headaches
alright thanks
In this Roblox Studio Simulator episode, we learn how to easily format and abbreviate numbers displayed to the Player using the FormatNumber library!
Subscribe for more Roblox Scripting Tutorials!
Format Number Forum Post: https://devforum.roblox.com/t/302-formatnumber-a-module-for-formatting-numbers/527979/42
Format Number Direct Download: ht...
oh its really easy to do that without yt
And a video in case you don't understand
lol
i tried the script it still says the same
Xd
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```
** You are now Level 15! **
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
im really confused
Alright
so
the leaderboard
i have the same one as you
i just dont feeel like fixing it
but ik whats wrong LOL
why there is no things on toolbox
dont know
but
it caps at 9.2qn
which is
a lot of 0's
so i wont write that out
yes
yeah
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
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
okay
like 10e60 or whatever it was at
Now
I have another abbreviating script
let me get it rq
here u go
Roblox is a global platform that brings people together through play.
Im trying it rn
on that i made that goes to 1OcDc
just also
use another leaderboard
this thing is crappy anyway
u can make a ebtter one
get this
i need u to help me with another one though bc ive tried multiple tutorials
i got it
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
true
because each one was from 0 to 308
now what do i do with that model
just put it inside ReplicatedStorage
i put them all in the things they should be
lol its just one thing
ye that was a example thing i did so people understand the system
now im not gonna use it cus i allrdy have a system
but
when youre saving HUGE number
s
its really nice to have
ues
so u using it to lol
i put like the same abbreviation script in every single part i need them values for
what do i do now for the leaderboard?
I have that aswell
oh lol i can give a Exponent BigNum but im still fixing the bugs
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
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)
why is the difference between qd and qn 2 and everything is 3
9 is B 12 is T 15 is Qd 17 is Qn 20 is Sx 23 is Sp 26 is Oc 29 is No
okay
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
ah
** You are now Level 4! **
btw what if i want there to be numbers after the decimal
so u see the lua return string.format('%.0f')
yes
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
ye
uhm so i see 0M or 0K how do i fix that
sometimes it does that
can i fix that?
dont know can u lol
but i dont know since i havent touched that script like about a month so i dont know
im hop on the the original to see what to fix
alr
can u recommend one
well thats odd for me its showing this
noah
it only happens when u have a value in the 100 like 100 or 100B
no toolboxes
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
oh the Reason is because its in exponent form not Number form
idk what that means but i just removed the + 1 after the exponent = exponent
how did u manage to fix it though?
so basically not since that will mess up the system
lol
i didnt
LMAO
that leaderboards weird
i dont use it
you can make one
they aint hard to make
Roblox is a global platform that brings people together through play.
here is something that has a BigNum
wdym
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
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
i give up bro
what is the problem?@pastel hollow
so i still have the same problem that the leaderboard caps at 9.2Qn
and i don't know how to make a new leaderboard
which one
OR create your OWN things....
OR learn how to SCRIPT
or watch a tutorial 
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
Worst thing to do
No it takes me 2 minutes to write my own by hand
@civic flicker how to make that script
i did but they dont seem to work
Can you guys help me?
Dog it’s been a day
They do work
The leaderboard tutorials
Or just get a free model
Less then twenty mins
which tutorial or model do u recommend
its saying an error now ive tried making a script
.
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```