#Currently learning DataStores, couple of questions

1 messages · Page 1 of 1 (latest)

compact oar
#
  1. I'm making a round based game and want to store player's data incrementally to not get rate limited. Should I make it so it saves between every round and/or make it save before the player leaves or just not bother and set it when it gets updated?
  2. What would the process be like with datastores with purchasing characters with in-game money? Should I create different scopes for every different character where it would be like:
local coolCharacterNameData = DataStoreService:GetDataStore("PlayerInventory", "Characters", "CoolCharacterName")
local coolCharacterName2Data = DataStoreService:GetDataStore("PlayerInventory", "Characters", "CoolCharacterName2")
local success, characterOwn = pcall(function(
  return coolCharacterNameData:SetAsync(plr.UserId, true)
end
-- yada yada yada...

...or should I do it differently? If I should do it differently, how should I do it?

compact oar
#

boost ^^

tidal magnet
#

downvote vv

compact oar
tame cliff
#

I didnt ignore it i saw it and the last time i used datastores was like half a year ago wehn I scripted my DataStore Module since then i am only using the API of my Module 😭

compact oar
#

aint nobody usin datastores anymore bro 😔

tame cliff
compact oar
#

hell naww

#

im good

tame cliff
#

this way you can also share data across universes

#

soo it has it pros

neat pumice
naive crag
#

so while you could do once every minute, 5 minute is a very generous buffer so you can have multiple datastores

naive crag
#

the other part of your question - purchase history - you can either shove it in with the regular data with a limit of like 50 entries or something, or use some other datastore and cap it at like 100~200, realistically you shouldn't ever need the purchase history if you just store the effects it has on savedata

#

the limit is shared

naive crag
#

aka purchase history

#

you do need some purchase history for processreceipt to work properly but beyond that you don't need it for anything else

compact oar
#

game currency

naive crag
#

oh

#

pff

#

just use a table who cares

#

array_of_bought_things={"superman","batman"} etc

#

and just pack/unpack aka serialize/deserialize when you translate from using it in a game to storing it in db

#

or be lazy with { ["superman"]=true; ["batman"]=true; }

silent orchid
naive crag
#

etc

compact oar
silent orchid
compact oar
#

im trying to make it so my money value changes my money gui and im already making some spaghetti slop code bruh 😭

naive crag
#

probably shouldn't be lazy like that with datastore storage quota but roblox says like 99% of games don't hit the 1mb per player limit

#

soo

compact oar
#

oh

#

i just reread

naive crag
#

i wouldn't say go nuts but i will say don't be afraid to put stuff in the player save table

naive crag
#

just uh

#

word to the wise, store a version along with your data

#

like your own version number

#

you'll need it later if you need to migrate ever

compact oar
naive crag
#

aka you change something fundamental about how your savetable works, you'll need version to know which savedata needs updating and which doesn't, since it is not feasible to loop through every datastore entry

#

might be able to use the keyinfo for a date/time and compare that to a date/time when you say the version changed is another way but just have a .version= in the table is very easy for beginner to work with

#

so yea

#

lots to learn and practice

compact oar
#

im gonna go to bed 😭