Save table to DataStore

I did that but its not working, Im getting the User Id’s by doing:

game.Player.PlayerAdded:Connect(function(player)
table.insert(table, player.UserId)
end)

and then i want to save those Id’s so i can do something with the players next time they join.

1 Like

Here’s a video he basically does the same exact thing I do.

1 Like

Maybe I didn’t explain myself well enough, sorry my bad, let me explain, I don’t want to individually save data within the table (like leader stats), I want to save the entire table, because the table will be empty, it will look something like this “local table = { }” and then I’ll use table.insert to add player Id’s.

Wait, what exactly are you wanting to do with the table? Are you wanting to save it for the server only or globally across every server?

Across every server, so if there User Id is in the table then when they join back into the game, they will be kicked, (kinda like a ban system).

uhh same concept then. just dont save the specific player userid. save with an custom id. then when the player joins just add there userid into the table if it aint there already

1 Like

Sorry I still don’t really understand what your saying, perhaps you could show me how its structured (I’m not asking for a complete script).

Yeah… uhhh that link you sent me, I’m not so keen on it, because it uses a Data Base from a third party, I want to save my tables just within my in game scripts (Data Stores).

make a temp table, get the ban table from the data store make that data the same as your temp so like temp_table = data, then when the player joins add there userid to the temp table, then when ever you want so like every minute or so you can save the temp table into your data store making it the new data. Sorry I took so long to type this i hope you understand now

1 Like

no it uses no third party module, your the one making the module and handling the actual data saving. It may seem like that since he is creating the data handler as a module script and in another script he is calling functions from that module on whether to save or add data

1 Like

How would I get a ban table from a data store? and how would I save this ban table within this data store?

Does the table already have information in it?
If you want to save a table to a datastore, you can do it by something like this:

local Table = {}
YourDataStoreName:SetAsync(Key, Table)

uhh you would saving it using the same key over and over, so when your saving you could use a key like “ban_data_key”.

1 Like

He’s using a website for the data store, I don’t want that, I want to save my table to a Roblox data store with DataStoreService.

no he is not. I do not see how he could be using a website to save his data. He is using roblox data store service

1 Like

If you want to save a table, you can make and use your own unique key.
Data Stores (roblox.com)
How to do a ban system with DataStore - Help and Feedback / Scripting Support - DevForum | Roblox

you should read up on the roblox data store documentation https://developer.roblox.com/en-us/articles/Data-store

1 Like

If you just scroll through the post in his link you will see he’s using third party software to handle a server with the data…

What? Do you mean the link in the reply? Then, no, It’s the official Roblox article for the DataStoreService.

1 Like