#profilestore data editing help

1 messages · Page 1 of 1 (latest)

sick jungle
#

so i have a game that uses profilestore. if i have a template like the image shown, how can i change all players' data?

For example, if i want to rename "Wanderer" to "Explorer" how would i be able to do that for all players with existing data?

formal islandBOT
#

studio** You are now Level 12! **studio

molten yoke
#

what you instead do is write migration code that updates a player's savedata to latest version and validates/verifies their data, renaming things as needed.

#

basically, you need to think about this from the opposite direction. you can't just "change all existing player savedata" that's not practical. you instead "change"/verify/update/etc the player savedata when they join.

#

and part of that can be a renaming rule

#

bear in mind you probably won't be able to ever use the original name for anything ever again without getting collisions, so if you want to be able to use the original name you'll need to make it version sensitive, i.e only rename if the savedata is older than a certain date

#

good luck salute

sick jungle
#

i looked thru documentation and couldnt find naything

#

this makes sense thank you very much

molten yoke
#

which means somewhere in your code, somehow, always, every little mistake you've ever made when building out the profile data will be recorded somewhere, forever. 🙂

quiet steeple
#

if the current version is greater than the datastore said version, update with the version table

#
local currentVersion = game.ServerStorage.DataStoreVersion.Value
local versions = {
  [1.1] = function(data)
    data.Coins = 0 -- resets coins
    return data
  end
}