Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a leaderboard with number prefixes for long numbers?

Asked by 6 years ago

I am making a tycoon game, and I am wondering how to make long numbers abbreviated in the leaderboard so that the whole number can be shown on the leaderboard. I have seen this kind of leaderboard in miner's haven and some other games with a money system, so I know it's possible. Here's the script:

local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("CashSaveSystem")
local ds2 = DataStore:GetDataStore("CashPerSecSaveSystem")

game.Players.PlayerAdded:connect(function(player)
 local leader = Instance.new("Folder",player)
 leader.Name = "leaderstats"
 local Cash = Instance.new("NumberValue",leader)
 Cash.Name = "Cash"
 Cash.Value = ds:GetAsync(player.UserId) or 0
 ds:SetAsync(player.UserId, Cash.Value)
 Cash.Changed:connect(function()
  ds:SetAsync(player.UserId, Cash.Value)
 end)
 local CashPerSec = Instance.new("NumberValue",leader)
 CashPerSec.Name = "Cash Per Second"
 CashPerSec.Value = ds2:GetAsync(player.UserId) or 0
 ds2:SetAsync(player.UserId, CashPerSec.Value)
 CashPerSec.Changed:connect(function()
  ds2:SetAsync(player.UserId, CashPerSec.Value)
 end)
end)


game.Players.PlayerRemoving:connect(function(player)
 ds:SetAsync(player.UserId, player.leaderstats.Cash.Value)
 ds2:SetAsync(player.UserId, player.leaderstats.Cash.Value)
end)
0
lmao, you didn't even try, u just gave random code on how to save it... greatneil80 2647 — 6y
0
do you know how to do it? VeryWowMuchDoge 47 — 6y
0
i didn't think so. VeryWowMuchDoge 47 — 6y

Answer this question