Hey y’all! I just made a post right before this one, but I wanted to keep the topics separate so it wouldn’t be more confusing than they already were. I just wanted to know how I could completely wipe my leaderboard free of times because I let a few friends test if the leaderboard worked and it does flawlessly. I was also informed about a plugin called datastore editor, I bought it, watched a handful of tutorials and showcases on YouTube about it but I’m clueless because I’m a beginner scripter! Here’s the script that handles the leaderboard itself and displays all players’ names and top times:
local DataStoreService = game:GetService("DataStoreService")
-- [ LOCALS ] --
local DataVer = "DataTimer" -- Data Store Name
local Store = DataStoreService:GetOrderedDataStore(DataVer.."LeaderBoardData")
local RationalDigits = 3 -- How many numbers show.
-- [ FUNCTIONS ] --
function GetLBData()
local success, pages = pcall(function()
return Store:GetSortedAsync(true, 10)
end)
if success and pages then
local data = pages:GetCurrentPage()
local a = 0
for _, entry in pairs(data) do
a = a + 1
if a == 1 then
end
local val = entry.value / 1000
local Addons={}
for t=1,RationalDigits do
local i = t-1
local integer,predecimal = math.modf(val*(10^i))
local decimal = predecimal/(10^i)
if decimal == 0 then
Addons[t] = "0"
end
end
local NewText = tostring(val)
for i,v in pairs(Addons) do
NewText = NewText..v
end
script.Parent.SurfaceGui["A" .. tostring(a)].PlrName.Text = entry.key .. ": " .. NewText
end
end
end
GetLBData()
while wait(60) do
pcall(function()
GetLBData()
end)
end