Just call SetAsync()/GetAsync() with a generic key, like “data” for example.
well you can just save it in a key that isn’t a player id
example,
local success, errorm = pcall(function()
local mydatastore:SetAsync("MyGlobalKey", myData)
end)
and when you want to load it, just use GetAsync() with your global key (in this case is “MyGlobalKey”)
So is ‘MyData’ a table? Just asking
it can be a table or a string, or just any value that can be set to a data store
So local mydatastore? What does this mean?
oh wait, lol. I’m sorry it was a typo, you can just remove the local or set something like
local data = mydatastore:SetAync("MyGlobalKey", myData)
So how would I define the local variable ‘mydatastore’?
oh, okay wait.
you can get “myDataStore” (or any thing you want to call it)
like this,
local datastoreservice = game:GetService("DataStoreService")
local myDataStore = datastoreservice:GetDataStore("globaldata") -- global data for example
local success, errorm = pcall(function()
local mydata = myDataStore:GetAsync("globalkey") --you can change this to any key
end)
if success then
print("Success loading global data!")
end
the first two line is how you get “myDataStore” and the other lines are just example
may i know why not just use datastore?
datastore2 has a thing called backups so even if the datastore is down it will just load the old data
Datastores have been proved to be extremely bad at handling saving issues. Data corruption when saving on leave, data corruption without warning after too many requests, etc.
As for OP’s question, @SR02justin could you please elaborate on what you mean by a datastore that isn’t tied to a player?
I mean like the server has the data and the data is not being saved to the player.
Data is never saved to the player. Data is saved by keys, as long as you have that key you can always access the data at any time. Data is always saved (by datastores) to the datastore itself.
I was trying to make a server browser system like arsenal but thanks for the comment but I already got my system working thanks to @ronald
I see what you’re trying to create however I really don’t recommend using datastores. It’s not secure and can cause tons of errors. I recommend using a node.js backend or memorystoreservice (better because the data won’t be saved in the end) and the likes.
could I use discord api maybe? Post a comment with the list of servers with ServerId, ServerRegion, Map, Gamemode, Team. Then get the list of server from the posted comment? Webhooks
Arsneal Server Browser is quite broken. If the server just started then their will be no servers listed in there. Arsenal devs say it is a api limit prevents the servers from showing
Another terrible idea, you’d need to identify those messages, split them, and get around message limits (2000 characters) and so on. Just use a node server (node.js) or memoryservice. There are articles on how to do this as well.
Here is an opensource module called MatchmakingService that utilizes MemoryStoreService for its queueing.
[v3.2.2-beta] MatchmakingService - Resources / Community Resources - DevForum | Roblox
You want a system that shows available servers so I recommend going with MemoryStoreService for it or using a node backend (node.js) that would save and remove entries from a mongodb database.
hello again, sorry for late reply. I’m not really familiar on how to use DataStore2, since i always use DataStore. You can still make DataStore Secure without using datastore2
@ronald do you know anything about the “MemoryStore” Service?