still:
can you show where this script is during a test?
local ds = game:GetService("DataStoreService")
local coinsODS = ds:GetOrderedDataStore("CoinsStats")
local timeUntilReset = 60
while true do
wait(1)
timeUntilReset = timeUntilReset - 1
pcall(function()
script.Parent.Parent.ResetTime.Text = "Resetting in " .. timeUntilReset .. " seconds..."
end)
if timeUntilReset == 0 then
timeUntilReset = 60
for i, plr in pairs(game.Players:GetPlayers()) do
coinsODS:SetAsync(plr.UserId, plr.leaderstats.Points.Value)
end
for i, leaderboardRank in pairs(script.Parent:GetChildren()) do
if leaderboardRank.ClassName == "Frame" then
leaderboardRank:Destroy()
end
end
local success, errorMsg = pcall(function()
local data = coinsODS:GetSortedAsync(false, 50)
local coinsPage = data:GetCurrentPage()
for rankInLB, dataStored in ipairs(coinsPage) do
local name = game.Players:GetNameFromUserIdAsync(tonumber(dataStored.key))
local coins = dataStored.value
local template = script.Template:Clone()
template.Name = name .. "Leaderboard"
template.PlrName.Text = name
template.Rank.Text = "#" .. rankInLB
template.Coins.Text = coins
template.Parent = script.Parent
end
end)
end
end
try this, you will need to tell me if the text updates because i put the error in a pcall
EDIT my bad, try it now
1 Like
its working thank you so much you help me so much i dont know how to thank you. i love you
1 Like