#Help with Global leaderboard
1 messages · Page 1 of 1 (latest)
i'm importing the script
local DataStoreService = game:GetService("DataStoreService")
local CoinsDataStore = DataStoreService:GetOrderedDataStore("WinsData")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local LeaderboardPart = script.Parent
local RefreshRate = 10
local function RefreshLeaderboard()
local Success, Error = pcall(function()
local Data = CoinsDataStore:GetSortedAsync(false, 50)
local RollsPage = Data:GetCurrentPage()
for Rank, SavedData in ipairs(RollsPage) do
local UserId = tonumber(SavedData.key)
local Wins = SavedData.value
if Wins > 0 then
local Username = game.Players:GetNameFromUserIdAsync(UserId)
local NewSample = script:WaitForChild("Template"):Clone()
NewSample.Parent = LeaderboardPart.SurfaceGui.ScrollingFrame
NewSample.Name = tostring(Rank)
NewSample.RankLabel.Text = "#" .. Rank
NewSample.NameLabel.Text = Username
NewSample.NumberLabel.Text = Wins
if Rank == 1 then
NewSample.BackgroundColor3 = Color3.fromRGB(255, 213, 0)
elseif Rank == 2 then
NewSample.BackgroundColor3 = Color3.fromRGB(192, 192, 192)
elseif Rank == 3 then
NewSample.BackgroundColor3 = Color3.fromRGB(205, 127, 50)
else
NewSample.BackgroundColor3 = Color3.fromRGB(216, 216, 216)
end
end
end
end)
end
while true do
for i, Frame in pairs(LeaderboardPart.SurfaceGui:WaitForChild("ScrollingFrame"):GetChildren()) do
if Frame.Name ~= "Template" and Frame:IsA("Frame") then
Frame:Destroy()
end
end
RefreshLeaderboard()
task.wait(RefreshRate)
end
use GlobalDataStore
How do I use it
thats the thing you gotta find out mate
I don't understand it
this should be the result when it works
i just need help, not to read the documentation
is k bro im here
is the script correct?
uh lemme read
because it doesnt send any error
i see error
local wins = saveddata.value should be local wins = SavedData.Value
sus bro
let me see
is already local Wins = SavedData.value
** You are now Level 5! **
value should be Value
if it is an instance then value property is capitalised Value
can you help me with my leaderboard too please
ts impossible
still not working
this is the datastore
the value 10 is the value of wins
ok ok
dm me
so i have to delete every pcall?
create another script but remove the pcalls