I want to have a daily leaderboard in my game that gets the amount of something you have gotten in that day, however I don’t know how exactly to make this leaderboard daily or make it so that the points you get in that day are the daily points the count towards that leaderboard reset daily, can somebody help me?
now im assuming i would have to make a value separate to the leaderboard then add one to each time the person survives, but how would i make it reset daily, even when the player is not playing?
I think you could refer to this here?
i see that it says it resets the leaderboard, but the leaderboard i want uses score in the leaderboard, so how do i get the survivals a person got in that one day, and reset the next day, including the leaderboard
also his seems a bit confusing on how to make the daily leaderboard work
i tried it and it kept showing me my points of all time and not daily
Use a unique identifier with os.date for your DataStore so it resets itself daily automatically. Would be best if you got the day of the year so that you don’t pull data from other years in the future. You can append this identifier to the DataStore’s name or use it as your scope.
local dayScope = os.date("%j/%Y") -- 038/2021
-- As a name
local dataStoreName = "LevelLeaderboard_%s"
local dataStore = DataStoreService:GetDataStore(dataStoreName:format(dayScope))
-- As a scope
local dataStore = DataStoreService:GetDataStore("LevelLeaderboard", dayScope)
You will have to work out any timezone kinks yourself if applicable. The os library, when used from the server, will return the current time in UTC.