How to remove player data individually?

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 :pray:

2 Likes

i think u can have them load into the server and delete their stuff from the server manually

But how would I do this? Is there a way to access this?

Table.remove(your table, your sleceted varaible you want to delete) if u are doing table

The pets are being stored through datastore, not tables. I’d like to remove these pets individually from a players inventory but I don’t know how to…

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.

Use RemoveAsync to remove data from a data store. This can be achieved via Roblox Studio’s command line.

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?

This paid plugin does wonders for your case, but will require you to remove the data in studio so it wouldn’t work in a live-game environment

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.

image
This is my data, from Profileservice, To do this go to List Stores > your store > List keys > your key

2 Likes

This will solve my problem perfectly. tysm for the help and everybody else who replied. :smile:
edit: paid for plugin

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.