You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I want to achieve on fixing the leaderboard, And a donation game.
- What is the issue? Include screenshots / videos if possible!
There is a lot of issues, when I test on single player (Roblox studio, and Roblox) it works but when I test on Roblox studio the datastore is printing my name and the players in are Player1 and Player2 and Player3, and it fails to find a player Called my name, and the other issue is when I try playing in normal Roblox (not in studio) is I Brang 3 players, me, my alt, and my friend. me and my friend joined together, and everything was working. and I Brang my alt and my friend left and the entire script broke.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried fixing but the datastore is just too much for me
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
my script (It wasn’t made by me):
-- [ SETTINGS ] --
local statsName = "Donated" -- Your stats name
local maxItems = 100 -- Max number of items to be displayed on the leaderboard
local minValueDisplay = 0 -- Any numbers lower than this will be excluded
local maxValueDisplay = math.huge -- (10 ^ 15) Any numbers higher than this will be excluded
local abbreviateValue = true -- The displayed number gets abbreviated to make it "human readable"
local updateEvery = 15 -- (in seconds) How often the leaderboard has to update
local headingColor = Color3.fromRGB(25, 181, 254) -- The background color of the heading
-- [ END SETTINGS ] --
-- Don't edit if you don't know what you're doing --
local DataStoreService = game:GetService("DataStoreService")
local Players = game:GetService("Players")
local DataStore = DataStoreService:GetOrderedDataStore("GlobalLeaderboard_" .. statsName)
local Frame = script.Parent.Frame
local Contents = Frame.Contents
local Template = script.objTemplate
local COLORS = {
Default = Color3.fromRGB(38, 50, 56),
Gold = Color3.fromRGB(255, 215, 0),
Silver = Color3.fromRGB(192, 192, 192),
Bronze = Color3.fromRGB(205, 127, 50)
}
local ABBREVIATIONS = { "K", "M", "B", "T", "Qa", "Qi", "Sx"}
local function toHumanReadableNumber(num)
if num < 1000 then
return tostring(num)
end
local digits = math.floor(math.log10(num)) + 1
local index = math.min(#ABBREVIATIONS, math.floor((digits - 1) / 3))
local front = num / math.pow(10, index * 3)
return string.format("%i%s+", front, ABBREVIATIONS[index])
end
local function getItems()
local data = DataStore:GetSortedAsync(false, maxItems, minValueDisplay, maxValueDisplay)
local topPage = data:GetCurrentPage()
for position, v in ipairs(topPage) do
local userId = v.key
local value = v.value
local username = "[Not Available]"
local color = COLORS.Default
local winners = game.ReplicatedStorage:WaitForChild("Bindables"):WaitForChild("WinnerEvent")
Contents.Items.Nothing.Visible = #topPage == 0 and true or false
local success, err = pcall(function()
username = Players:GetNameFromUserIdAsync(userId)
end)
print(username)
if position == 1 then
color = COLORS.Gold
winners:Fire(workspace:WaitForChild(username), 1)
elseif position == 2 then
color = COLORS.Silver
winners:Fire(workspace:WaitForChild(username), 2)
elseif position == 3 then
color = COLORS.Bronze
winners:Fire(workspace:WaitForChild(username), 3)
end
local item = Template:Clone()
item.Name = username
item.LayoutOrder = position
item.Values.Number.TextColor3 = color
item.Values.Number.Text = position
item.Values.Username.Text = username
item.Values.Value.Text = abbreviateValue and toHumanReadableNumber(value) or value
item.Parent = Contents.Items
end
end
script.Parent.Parent.Color = headingColor
Frame.Heading.ImageColor3 = headingColor
Frame.Heading.Bar.BackgroundColor3 = headingColor
while true do
for _, player in pairs(Players:GetPlayers()) do
local leaderstats = player:FindFirstChild("leaderstats")
if not leaderstats then
warn("Couldn't find leaderstats!")
break
end
local statsValue = leaderstats:FindFirstChild(statsName)
if not statsValue then
warn("Couldn't find " .. statsName .. " in leaderstats!")
break
end
pcall(function()
DataStore:UpdateAsync(player.UserId, function()
return tonumber(statsValue.Value)
end)
end)
end
for _, item in pairs(Contents.Items:GetChildren()) do
if item:IsA("Frame") then
item:Destroy()
end
end
getItems()
wait()
Frame.Heading.Heading.Text = statsName .. " Leaderboard"
Contents.GuideTopBar.Value.Text = statsName
wait(updateEvery)
end
If you want some script just reply, any replies helps.
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.