Can anyone help because my game wouldve been released if i found a fix to the problem
Are you trying to store a list of every player that ever joined your game?
You could use a datastore for each player that has a bool set to false by default, when the player joins, this player is added to a second datastore(a datastore which holds a string containing all the saved players), unless the bool is true.
the player specific datastore with the bool value is then marked as true so the player only gets added to the list once.
Firebase datastore i guess pppppp
I’d say probably use the DataStoreService
.
You can’t get them all from a normal DataStore
. You would need to use an OrderedDataStore
’s GetSortedAsync()
function.
local store = game:GetService("DataStoreService"):GetOrderedDataStore("YourStore")
local players = game:GetService("Players")
--save the player's key to the store when they leave
local function onLeave(player:Player)
local success, err = pcall(function()
store:SetAsync("Key_"..player.UserId, 1)
end)
end
players.PlayerRemoving:Connect(onLeave)
--get all the keys
local function getAllKeys()
local keys
local success, err = pcall(function()
local keys = store:GetSortedAsync(false, --[[number of keys to be read]])
end)
if success and keys then
local page = keys:GetCurrentPage()
for i, saveData in ipairs(page) do
local rawKey = page[i]
local key = rawKey.key
local user = string.split(key, "_")[2]
local success, err = pcall(function()
print(players:GetNameByUserIdAsync(user))
end)
end
end
end
edit: Apparently you can get all the keys from a normal DataStore
using ListKeysAsync()
.
Every datastoreservice is better than roblox datastore XD
But personally I would use httpservice to send the userid of every player that joined to a google spreadsheet.
This way I can configure the spreadsheet itself to delete any duplicates.
Additionally you could add another script to the spreadsheet that fetches player names and account links from the given userid.
At least it’s provided to us for free
Like if you tried to make a website with an account system you’d have to pay for a database which kinda sucks (this was me)
Or host it yourself on an old secondhand laptop for 20$
Xd. Firebase is cool because it’s for free and easy to use. You’re right but if you want to make bigger game, i prefere dss with more storage
ehhhhhhh energy bills in my city are going up
I’ve heard firebase is free but you need to add a bank account or CC info
Idk, i don’t have to. It’s your opinion, so yeah. Have a nice day
You too
Jeez that’s a long link lmao but uhh it’s probably more worth it and more reliable to use DSS imo
thanks for telling us about this though
DataStore:ListKeysAsync()
is your best bet here - it lists out all the existing keys of that given datastore you’re trying to get all the keys from.
If this didn’t help you, you’ll have to elaborate on your question further.
Also, sorry to have to add this on as a separate reply to the thread, I don’t want to have to mention the OP for something irrelevant -
-but it’s pretty silly to still see people say things like “x database is better than roblox datastores”.
Firebase is cool because it’s for free and easy to use.
It’s free - until you start to scale it up. Afterwards, the cost also scales up, often to the point where it’s unsustainable for the average Roblox developer.
Or host it yourself on an old secondhand laptop for 20$
Right… let’s conveniently forget that energy and internet bills exist, for the sake of argument.
It’s sh*t like this that tells me (and many others) that the people who says things like these haven’t actually done anything decently sized on Roblox yet.
Puts into question just how versed they are in this topic.
The grass isn’t always greener on the other side - you just haven’t been there yet.
Besides, this is scripting-support. Keep this nonsense elsewhere.
It was a joke, sorry you couldn’t tell.
I thought it was obvious considering my advice to weld a solar panel to the back of it.
A Google Sheet can only contain I think it’s 15k rows, that can go in a few months for most games that have a DAU of like 50 or more.
Besides, this is scripting-support. Keep this nonsense elsewhere.