How to use datastore with tables in server?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I want to know If i use good or not datastore with tables

  1. What is the issue? Include screenshots / videos if possible!

Not a issue

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub

Yes, but it show only normal datastore not what i want

So when i player leave i whould use


game.Players.PlayerRemoving:Connect(function(plr)

local datastore = game:GetService("DataStoreService"): GetDataStore ("Bann")

datastore:SetAsync(banned, plr.UserId)```

Or

`local banned = {"EXAMPLE"}

game.Players.PlayerRemoving:Connect(function(plr)

local datastore = game:GetService("DataStoreService"): GetDataStore ("Bann")

datastore:SetAsync(banned)```

What should i use?

There is nothing generally wrong with using tables in data stores, it really comes down to what you are saving and how much, and what your personal preference is. I will say though It might be a good idea to look into Datastore2 for “safer” saving, I might also add that saving tables (I believe) takes up a little more “space” than numbers and words/strings do, so I wouldn’t just use tables for no reason, use them when you need them!

2 Likes