Hi, I am making a game where it rolls a certain rarity every time you roll and I would like to keep track of how many of each the player has rolled (attached photo for reference). My first thought was to use datastores to do this but I have 36 rarities and making a datastore for each one not only takes a very long time to load but also exceeds the datastore request limit and causes the game to break. I was wondering if there was a way to keep track of them all separately but using a different method?
As a side note I can identify which one has been rolled just currently have no way of saving that data and then showing it inside this GUI.
A datastore entry can be get, set and updated from any script running on the server side.
But a better and more realistic approach would be to load the data once from the datastore when the player joins, update that data during their session then when they leave save their data to the datastore again.
I understand that but the fact that it is inside a table in a script im not sure how i would update the table from another script and then also how i fetch that data? im not experienced with saving a table like that
local data = rarityDataStore:GetAsync(Player.UserId) -- Load Data
-- That returns the data table {common = 201, uncommon = 34, rare = 4, ultraRare = 1}
data.common += 1 -- Add 1 to common
-- Data is now {common = 202, uncommon = 34, rare = 4, ultraRare = 1}
rarityDataStore:SetAsync(Player.UserId) -- Save Data
But this is not a realistic approach.
I recommend you to watch some youtube videos about datastores and maybe just about the entirety of scripting on roblox.