In one of my games for the past couple of weeks, the in-game leaderboard has been stuck on specific times. However when I update my own time, it just stays.
This hasn’t been a problem ever. I haven’t touched the leaderboard.
Another problem which may be apart of the problem?
Attempting to save data in the command bar returns a malformed number error.
The script of the leaderboard seems perfectly fine and I have zero clue why it shouldn’t update
local DataStoreService = game:GetService("DataStoreService")
local CoinsLeaderboard = DataStoreService:GetOrderedDataStore("time_wasted")
local function updateLeaderboard()
local success, errorMessage = pcall(function()
local Data = CoinsLeaderboard:GetSortedAsync(false, 50)
local CoinsPage = Data:GetCurrentPage()
for rank, data in ipairs(CoinsPage) do
local userName = game:GetService("UserService"):GetUserInfosByUserIdsAsync({tonumber(data.key)})
local Name = userName[1].Username
-- print(Name)
local DisplayName = userName[1].DisplayName
local Coins = data.value
local isOnLeaderboard = false
for i, v in pairs(script.Parent.LeaderboardGui.Holder.ScrollingFrame:GetChildren()) do
if v.player.Text == Name then
isOnLeaderboard = true
break
end
end
if Coins and isOnLeaderboard == false then
local newLBFrame = script:WaitForChild("template"):Clone()
newLBFrame.player.Text = DisplayName.." (@"..Name..")"
local hour = math.floor(Coins/60)
local min = Coins - (hour*60)
newLBFrame.time.Text = hour.."h "..min.."m"
newLBFrame.rank.Text = "#"..rank
newLBFrame.Position = UDim2.new(1, 0, 0.02 * (#game.Workspace.bus.destroy_upon_crash.LeaderBoard.scr.LeaderboardGui.Holder.ScrollingFrame:GetChildren()), 0)
newLBFrame.Parent = script.Parent.LeaderboardGui.Holder.ScrollingFrame
game:GetService("TweenService"):Create(newLBFrame, TweenInfo.new(0.5), {Position = UDim2.new(0, 0, 0.02 * (#game.Workspace.bus.destroy_upon_crash.LeaderBoard.scr.LeaderboardGui.Holder.ScrollingFrame:GetChildren() - 1), 0)}):Play()
local ps, pe = pcall(function()
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size420x420
local content, isReady = game.Players:GetUserThumbnailAsync(tonumber(data.key), thumbType, thumbSize)
newLBFrame.plrPortrait.Image = content
end)
end
end
end)
if not success then
print(errorMessage)
end
end
Any information would be helpful!