as you can see in the output
they Printed the player.Timer.Second2.Value
BUT they Dont print the success that mean the code doesnt execute that line?
I guess error in some line between that 2 print
There no error output
If u found any error or things that not work i will really appriciate
Thanks alot
I can’t speak for all of the issues you are having, but one immediate error that stands out is your excessive amount of DataStore requests. There are limits to DataStores, and one limit is that you cannot call too many within a certain time span.
Read the following article for more information. The subsection regarding DataStore limitations is toward the bottom of the page.
Could you provide more clarification on the other issues you’re dealing with?
local TimerDataStore = DataStoreService:GetOrderedDataStore("TimerLeaderboard")
local leaderboardPart = script.Parent.Parent.Parent
local RefreshRate = 5
local function RefreshLeaderboard()
for i, player in pairs(game.Players:GetPlayers()) do
TimerDataStore:SetAsync(player.UserId, player.Timer.Second2.Value)
print(player.Timer.Second2.Value)
end
local Success, Error = pcall(function()
local Data = TimerDataStore:GetSortedAsync(false, 7)
local TimerPage = Data:GetCurrentPage()
for Rank, SavedData in ipairs(TimerPage) do
local username = game.Players:GetNameFromUserIdAsync(tonumber(SavedData.key))
local Time = SavedData.Value
print(SavedData.Value)
local NewSample = game.ReplicatedStorage.Sample:Clone()
NewSample.Visible = true
NewSample.Parent = leaderboardPart.SurfaceGui.Frame
NewSample.Name = username
NewSample.Rank.Text = Rank
NewSample.UserName.Text = username
NewSample.Amount.Text = Time
print("Successs")
end
end)
end
while true do
for i, Frame in pairs(leaderboardPart.SurfaceGui.Frame:GetChildren()) do
if Frame.Name ~= "Sample" and Frame:IsA("Frame") then
Frame:Destroy()
end
end
RefreshLeaderboard()
wait(RefreshRate)
end
local TimerDataStore = DataStoreService:GetOrderedDataStore("TimerLeaderboard")
local leaderboardPart = script.Parent.Parent.Parent
local RefreshRate = 5
local function RefreshLeaderboard()
for i, player in pairs(game.Players:GetPlayers()) do
TimerDataStore:SetAsync(player.UserId, player.Timer.Second2.Value)
print(player.Timer.Second2.Value)
end
local Success, Error = pcall(function()
local Data = TimerDataStore:GetSortedAsync(false, 7)
local TimerPage = Data:GetCurrentPage()
for Rank, SavedData in ipairs(TimerPage) do
local username = game.Players:GetNameFromUserIdAsync(tonumber(SavedData.key))
local Time = SavedData
print(SavedData)
local NewSample = game.ReplicatedStorage.Sample:Clone()
NewSample.Visible = true
NewSample.Parent = leaderboardPart.SurfaceGui.Frame
NewSample.Name = username
NewSample.Rank.Text = Rank
NewSample.UserName.Text = username
NewSample.Amount.Text = Time
print("Successs")
end
end)
if not Success then
print(Error)
end
end
while true do
for i, Frame in pairs(leaderboardPart.SurfaceGui.Frame:GetChildren()) do
if Frame.Name ~= "Sample" and Frame:IsA("Frame") then
Frame:Destroy()
end
end
RefreshLeaderboard()
wait(RefreshRate)
end
Whoops Sorry for waste you all time
MY friend Fixed this for me
he said it must be SavedData.value and v must be lowercase since key is lowercase too
idk how it work but it really worked for my game xd