How to change someone data from across servers on even when they are offline

I want to find a way to change players data even when they aren’t in the same server because I’m making a crew system that saves and its difficult to kick a player out of a crew without them being in the same server at the same time. I am currently trying to figure out a way to achieve this. I’ll accept any help as long as its related to this.

As long as you know the key you can edit the DataStore.
For example:
I can call DataStore:GetAsync(1601717939) (that’s my UserId) and I can get the current value. Then I can call DataStore:SetAsync(1601717939, 10000) to change the value to 10000. Same thing for :UpdateAsync() and others. I do not need to join the game and the values can already be changed. When a player kicks the other player out of the crew you can use :SetAsync() or :UpdateAsync() and remove the player’s name/UserId from the array or dictionary.

Does it also work when the said player is offline?

If you are looking to do this really easily with no hassle, I’d recommend you to get the plugin “Datastore Editor” it allows you to edit datastores for players even though they are offline.

I am trying to find a way for players to send requests across servers to each other and for people who are offline, are you sure this plugin will solve this?

It will work as long as you have the correct key being passed, datastores are like a key and value pair kind of, and you probably used the UserId of the player to save / get data in your main script.

So using something like below, will work, as long as you’re passing the correct key.

DataStore:GetAsync(UserId), DataStore:SetAsync(UserId, Value)

I see. I guess that this could also be used for GUIs?

as in a player thats in another server sends a reuqest to a player thats offline, and when that player joins a gui pops up telling them someone sent them a request.

The player does not need to be online. As long as you have the key you can access it.

Alright thanks I’ll update you if it works accordingly.

You can’t access Datastores from Client side (that would have been so exploitable.)

But what you can do is create your UI, and have a remote event handled by a server script which takes in the Username of the player you want to remove, run your checks (such as if that person is in the crew etc.) and then you can use the GetUserIdFromUserName method to get the UserId, which is your key and then set the data.

1 Like

Thank you! It took me a while to understand but it works!

1 Like