How to change datastore values without the target being in game

Ok I just want to know if its possible to save data in game while another player is not in the game, for example a bit like the datastore editor. Pretty much a good example is Arsenals ban system. What I want to do is make a ban system that doesn’t require the target to be in the game, if there is a way to change players datastore values I would really like to know how.

All you have to do is use SetAsync in the console you should know how to do this via reading your datastore script.

I want the game to be able to do that not the dev console

Then make a GUI or something to do it in.

Thats what I’ve done I just wanna know specifically what I need to do to change a datastore value of a player that is not in the game.

1 Like

You do the exact same thing you would if they weren’t in game, I will get you an example in a moment.

local datastoreService = game:GetService("DataStoreService")
local keyToEdit = "KEY"
local datastore = datastoreService:GetDataStore("datastorename")
datastore:SetAsync(keyToEdit, "banned")

So SetAsync can be used even without the player being in the game?

datastore is just func to keep data you can store anything without player but it need key
if you want to store player data just put userid of player on setasync datakey

As long as you have the key then yes.

arsenal maybe use game.Players:GetUserIdFromNameAsync to find userid from playername

Ah I can see that being a lot more effective thanks for the info, I’ll see if I can put all of this to use then post an update.

Ok so that solved on of my problems but now Im not sure how I would change the saved data. Since SetAsync() requires two arguments and the main problem is how would I edit the specific data.

SetAsync(datastore_key, data_to_repeat)

What is data_to_repeat? Is that the specific thing that gets changed?

it your data name sry for late