Hey everyone! I hope your having a great day. I just wanted to know how I can reset stats for someone who isn’t in the same server as me. I tried using the datastore editor plugin but it doesn’t work at all for me. Anyone know how I can do that without joining the players server?
This depends on the infrastructure of your datastores. The usual setup is that people just store data in tables, using the player’s UserId
as the index. Is this what your datastore looks like?
yea i save stats in a table
(30words)
If you want to edit the datastore, you could probably just find the user id from the player’s username, either by using Players:GetUserIdFromNameAsync
or just looking up his user id from his profile, which would be the set of numbers right before /profile
. This is my UserId, for example:
You could then edit this script directly, in a place that is in the same game as where the user’s data is, by either requiring it from a dummy module script from the command line and editing the datastore there, or pasting all of the script in the command line at the same time and executing it there.
e.g, in a ModuleScript
:
local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")
--edit this
local userid = Players:GetUserIdFromNameAsync("unworthy user here")
--edit that
local store = DataStoreService:GetDataStore("name", "scope")
--this too
local newData = {
-- new attributes here
}
local s, msg = pcall(function()
store:SetAsync(userid, newData)
end)
print(s, msg)
return 0
DataStore Editor plugin requires you to be the owner of the place and for Studio API access to be enabled. Once this is done, you can use the plugin. Just fill out the fields as they look for your DataStore script, queue a key and get to work.
On the other hand, if you’re looking for a run time solution, you have the option of either using the code above or MessagingService to communicate with other servers in real time so that the server with the target player in it can handle their data and inform then of changes in real time.