Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Custom Leaderboard and Datastore?

Asked by 8 years ago

So to start I just put two questions in one to save space, Plus I'd have to wait 30 minutes.

So to start off I wanted to ask if anyone knows anything about custom leaderboards, Not leaderboard stats but just the board that displays the names, is their a way to customize it? If you could help me learn anything about this that would be great.

Second, Datastores, I wanted to know, How do we saves stuff to em? How do we unload stuff to em, and how exactly does the server keep track of like what data belongs to what player, or do I have to script that. I also wanted to know, is it possible to save datastore stuff in numbers like 012000 and so the first number, 012 is like a chair or something, and then the 000 after it is quantity, or do datastores not exactly work that way.

Thanks for any help you can offer!

0
This is NOT requesting helpers. Sorry, but we only provide fixes for scripts that do not work already. We do not offer step-by-step tutorials. itsJooJoo 195 — 8y
0
This isn't a request, You do realize many players have posted questions about things with no script, I posted a question about operators once and I got tons people helping me out. Conmmander 479 — 8y

1 answer

Log in to vote
1
Answered by
brianush1 235 Moderation Voter
7 years ago

First off, for custom leaderboards:

You can create your own GUI to replace the leaderboard, but not customizing the existing one. If you'd like to disable the default leaderboard, use this code in a localscript: (API:Class/StarterGui/SetCoreGuiEnabled)

game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)

Second, for data store:

If you want to use a datastore, call the DataStoreService::GetDataStore method and use UpdateAsync to update a value. Example: (API:Class/GlobalDataStore/UpdateAsync)

local DataStore = game:GetService("DataStoreService"):GetDataStore("Points")

game.Players.PlayerAdded:connect(function(player)
    local key = "user_" .. player.userId
    --we want to give 50 points to users each time they visit
    DataStore:UpdateAsync(key, function(oldValue)
        local newValue = oldValue or 0 --oldValue might be nil
        newValue = newValue + 50
        return newValue
    end)
end)

P.S: You cannot yield in UpdateAsync, so don't use functions like wait(), or any function classified as YieldingFunction in the ROBLOX Wiki

This is explained in much greater detail at the ROBLOX Wiki (Data Store)

Ad

Answer this question