Ok, so i have 2 global leaderboards which i’ve been using for more than 2 months now.
Recently one of them has started acting weird, but the other one is completely fine…
The board which is having problems actually doesn’t show the #1 Player On The List but it does for the other leaderboard.
here are some screenshots -:
The board which has having problems .
The Board which is completely fine.
I haven’t messed with any of their scripts.
The script -:
local DataStoreService = game:GetService("DataStoreService")
local KillsLeaderboard = DataStoreService:GetOrderedDataStore("KillsLeaderboard")
local function updateLeaderboard()
local success, errorMessage = pcall (function()
local Data = KillsLeaderboard:GetSortedAsync(false,30)
local Killspage = Data:GetCurrentPage()
for Rank, data in ipairs(Killspage) do
if tonumber(data.key) > 0 then
local username = game.Players:GetNameFromUserIdAsync(tonumber(data.key))
local userid = data.key
local Time = data.value
if Rank == 1 then
local npc = game.workspace:FindFirstChild("TKIllsWinner1")
if npc then
npc.One.Base.Ui.Plr.Text = username
npc.UserId.Value = userid
npc.One.Base.Ui.Num.Text = Time.." TKills"
end
end
if Rank == 2 then
local npc = game.workspace:FindFirstChild("TKillsWinner2")
if npc then
npc.To.Base.Ui.Plr.Text = username
npc.UserId.Value = userid
npc.To.Base.Ui.Num.Text = Time.." TKills"
end
end
if Rank == 3 then
local npc = game.workspace:FindFirstChild("TKillsWinner3")
if npc then
npc.Tree.Base.Ui.Plr.Text = username
npc.UserId.Value = userid
npc.Tree.Base.Ui.Num.Text = Time.." TKills"
end
end
local isOnLeaderboard = false
for i, v in pairs(game.Workspace.KillsGlobalLeaderboard.Middle.Leaderboard.Holder:GetChildren()) do
if v.Player.Text == username then
isOnLeaderboard = true
break
end
end
if Time and isOnLeaderboard == false then
local newLbFrame = game.ReplicatedStorage:WaitForChild("TKillsFrame"):Clone()
newLbFrame.Player.Text = username
newLbFrame.TKills.Text = Time.." TKills"
newLbFrame.Rank.Text = "#"..Rank
if newLbFrame.Rank.Text == "#1" then
newLbFrame.Player.BackgroundColor3 = Color3.fromRGB(255,174,0)
newLbFrame.Player.Text = "👑"..username.."👑"
newLbFrame.Rank.BackgroundColor3 = Color3.fromRGB(255, 174, 0)
newLbFrame.TKills.BackgroundColor3 = Color3.fromRGB(255, 174, 0)
end
if newLbFrame.Rank.Text == "#2" then
newLbFrame.Player.BackgroundColor3 = Color3.fromRGB(167, 167, 167)
newLbFrame.Rank.BackgroundColor3 = Color3.fromRGB(167, 167, 167)
newLbFrame.TKills.BackgroundColor3 = Color3.fromRGB(167, 167, 167)
end
if newLbFrame.Rank.Text == "#3" then
newLbFrame.Player.BackgroundColor3 = Color3.fromRGB(235, 123, 18)
newLbFrame.Rank.BackgroundColor3 = Color3.fromRGB(235, 123, 18)
newLbFrame.TKills.BackgroundColor3 = Color3.fromRGB(235, 123, 18)
end
newLbFrame.Position = UDim2.new(0, 0, newLbFrame.Position.Y.Scale + (0.03 * #game.Workspace.KillsGlobalLeaderboard.Middle.Leaderboard.Holder:GetChildren()),1)
newLbFrame.Parent = game.Workspace.KillsGlobalLeaderboard.Middle.Leaderboard.Holder
end
end
end
end)
if not success then
warn(errorMessage)
end
end
while true do
for _, player in pairs(game.Players:GetPlayers()) do
KillsLeaderboard:SetAsync(player.UserId, player.TTime.Value)
end
for _, frame in pairs (game.Workspace.KillsGlobalLeaderboard.Middle.Leaderboard.Holder:GetChildren()) do
frame:Destroy()
end
updateLeaderboard()
wait(60)
end
The other one which is working fine has the same script just with changed values so it shows the other
currenncy or whatever you want to call it.
Also there are some more weird things with the broken board it is showing in accurate values for example i have 455 kills and it says 411 on the leaderboard i think my datastore of this value has been fried
kindly help me please…
PS: if there is ANYTHING you could think please tell me because i think my datastore of this value is fried.