If you have a system for tracking how fast someone completed a course. Then all you would have to use is :SetAsync() into your OrderedDataStore. So how it would work is once the player completes the race, you’d insert their time into the DataStore. Example:
local Store = game:GetService("DataStoreService"):GetOrderedDataStore("StoreName")
local function raceFinished(player, time)
local key = player.UserId
local success, err = pcall(function()
if not success then warn(err) else
return print("Saved time for, ".. player.Name)
Then in your leaderboard script you could run another pcall function using :GetNameFromUserIdAsync() to get the player’s name since the key is their userId which never changes (to my knowledge). Then compare using your Order Data Stores, :GetSortedAsync() function and do your leaderboard stuff.
I don’t have a system for getting the players info saved. I just don’t get what leaderboard scripting is like though… is there a tutorial I can follow for it? cause I’ve looked and most all globals are not based on time. would I just need to change from say ‘cash’ to ‘time’
To store data, it has to be on the server. The client can’t store it’s own data. You could use RemoteEvents to send this value to the server, but this has security risks. Ideally, you should have the data being tracked on the server for security purposes. If the client needs it, you can either use value objects or RemoteEvents to send it to them.
There is no way to send information to the server from a client without using RemoteEvents or RemoteFunctions. RemoteEvents and RemoteFunctions exist solely for client-server and server-client communication.
Any other way that works is most likely not intended behavior and not a great idea to use. Is there a reason you wish not to use remote events?
Hello @CrillicD, just wondering if you have managed to get your script working, as me and my son are needing a similar script. We have a working timer in leaderstats and would like to know how to register the time on a global leaderboard when a certain block is touched. We have set up an ordered data store but it is not registering the time. Thank you.