How to prevent 2 values saving at same time or how to make a clan system

So i’ve made something like this (not finished)

local Datastoreser = game:GetService("DataStoreService")

local DataStore = Datastoreser:GetDataStore("Clans")

local NewClan = {"RyClan", 1, 2000, 5}
DataStore:SetAsync()

print(DataStore:GetAsync("Clans"))

so i want to make it so you can save it into a table in a datastore (i already saved a table with the key “Clans”) but if i save a value, it saves too but if someone from another server saves it at the same time, only 1 will save.
How can i fix this?

Oops wait i didnt paste the whole script.
Here.

local Datastoreser = game:GetService("DataStoreService")

local DataStore = Datastoreser:GetDataStore("Clans")

local NewClan = {"RyClan", 1, 2000, 5}
local Clans = DataStore:GetAsync("Clans")
table.insert(Clans, NewClan)
DataStore:SetAsync("Clans", Clans)

print(DataStore:GetAsync("Clans"))

You are setting data with the same key, thats why it won’t work. Also I recommend using pcalls to ensure it doesn’t break while saving data as DataStores can fail (userId is the player’s userId

local Clans
local success, errorMsg = pcall(function()
Clans = DataStore:GetAsync("Clans_"..userId) 
end) 

if success then
table.insert(Clans, NewClan) 
else warn(errorMsg) end

local success1, errorMsg1 = pcall(function()
DataStore:SetAsync("Clans_"..userId, Clans) 
end) 

if success1 then
print(Clans)
else warn(errorMsg1) end

The thing is if you want to make a UI with the list of clans, you cant just get all player id’s.
And ordereddatastore doesnt work that well for me.

Unfortunately you have to do that, else player datas will overwrite eachother and not save
So you will need to stick to that

Then i cant create it so theres a list.
I want this to happen like in other things like private server lists and other clan systems.