So I have an issue within my game. I have separate datastores for individual player pets. However, I’ve made some name changes/rarity changes that have broken players inventories. This I’m assuming is due to the players hatching the pets BEFORE actually updating them, registering as the pet not existing.
I’d like a good way where I can easily remove the pets individually from the players inventories, like datastores editing or something. I’m really bad at things like this so if anybody has a simplified solution or script, please lmk
You can get the user Id, search in that datastore for the “key”, which should be based off of the userId, And then use UpdateAsync() and GetAsync() to get the data, remove, or add what you wish, and update it back in.
you can have some sort of ‘admin command’ on your game and have a player play the game, then use commands like :subtractCoins or something, but if you’re talking about removing DATA then the people above me might have provided the solution
But how would I get these player keys from the player to then remove that individual pet? Because just doing normal datatsore functions to remove individual data is too complex…
Again, I’m Specifically looking for a solution to remove just one pet from individual player inventories. Just removing the async won’t do too much, would it?
Use GetAsync to retrieve their existing data, change it manually, then use SetAsync to override their existing data.
local data = datastore:GetAsync(player.UserId) --change this
print(data) --dictionary representing player's data (change this)
datastore:SetAsync(player.UserId, data) --change this
Could I get the key from my players datastore and use it to delete the data? I’m not necessary looking for live environment removal, but more sorta like removing it from studio
You can lookup your datastores, select the key which could look like e.g. PlayerData_useridhere, and then it’ll show you their data that you can edit, remove, or add onto and then save.
This is my data, from Profileservice, To do this go to List Stores > your store > List keys > your key