#leaderboard

50 messages · Page 1 of 1 (latest)

stark vessel
#

?

wary folio
stark vessel
#

Ye no ur script is trash

wary folio
#

u aint even seen it

neat fern
#

I mean it doesn’t work

#

So he does have a point

wary folio
#

i just dont know how to make it so it displays its peak on the leaderboard and not current

#

my script for it is fine

#

just not sure how to make it peak clicks not current

neat fern
#

Do you have a datastore set up?

wary folio
#

for the lb?

neat fern
#

For the statistics

wary folio
#
local dss = game:GetService("DataStoreService")
local ODS = dss:GetOrderedDataStore("Clicks")

local stat = script.Parent.Stats
local template = game:GetService("ServerStorage"):WaitForChild("Template")

local cd = 30 * 2

local function updateBoard()
    local data =ODS:GetSortedAsync(false, 10)
    local page = data:GetCurrentPage()
    
    for i,v in ipairs(page) do
        local name = game:GetService("Players"):GetNameFromUserIdAsync(v.key)
        local clicks = v.value
        local rank = i
        local onBoard = false
        
        for i,v in pairs(stat:GetChildren()) do
            if v:IsA("UIListLayout") then continue end
            
            if v.Name == name then
                onBoard = true
            end
            
        end
        if clicks and not onBoard then
            local temp = template:Clone()
            temp.Name = name
            temp.Player.Text = name
            temp.Rank.Text = rank
            temp.Clicks.Text = clicks
            temp.Parent = stat
        end
    end
end

while true do
    for i,v in ipairs(game:GetService("Players"):GetPlayers())  do
        ODS:SetAsync(v.UserId, v.leaderstats.Clicks.Value)
        
    end
    for i,v in pairs(stat:GetChildren()) do
        if v:IsA("UIListLayout") then continue end
        
        v:Destroy()
    end
    updateBoard()
    task.wait(cd)
end
#

and got a ds for clicks

neat fern
#

The leaderboard should be taking their data from a datamanger, not straight from the datastore

#

Welp time to read

#

Please don’t tell me your datamanager is split up over multiple access points

wary folio
#

i just got a datastore for the clicks in SSS and this script in the leaderboard part in workspace

neat fern
#

Why are they not hooked up together?

#

Eh not my game so doesn’t matter

wary folio
neat fern
wary folio
#

😂

neat fern
#

Please tell me you know how modules work

wary folio
#

sorta

neat fern
#

I can barely think off how a datamanager can be over 200 lines, how did you ever get to 700

wary folio
#

just combind most of my scripts into one to keep it clean

neat fern
#

Please tell me you at least structured it in some way

wary folio
#

nah

neat fern
#

Then how is it cleaned up?

wary folio
#

the explorer looks clean

#

:)

#

not the script

#

anyways back to the leaderboard

neat fern
wary folio
#

ill clean everything up later

#

if i do one thing im focused on thast

#

not 2-3 or more things at once

neat fern
#

But just wondering, does your main datamanager save a max clicks amount?

#

as I’m guessing “clicks” is the name for the current clicks

neat fern
#

Well the leaderboard is receiving the datastore saving your current keys

#

At least by name I’m guessing that as your datastore naming is a tad weird

#

I recommend having your main datahandler save a max amount of clicks. Then just have a system in place to check if currentClicks > maxClicks. If so then maxClicks = currentClicks

wary folio
#

alr ill try something rq

#

do i make a variable for maxClicks?

gusty brook
#

Save it on a maxClick index/variable