The data is a dictionary with all the user ids who joined the game (which is what he asked for).
I provided him with a script with an in-depth explanation that he prefers to use, and therefore the topic is solved. Unless there is an issue with my solution that would negate the effectiveness, this topic no longer needs replies. It was not necessary to jump in and comment on the relevancy of my explanation, when I was explicitly asked for such explanation, due to the fact that the topic has been marked solved, and the reply you made did not add any missing details to the solution or to the topic in general.
Unless there is anything important or relevant to add to this, we are done here.
local datastores = game:GetService("DataStoreService")
local datastore = datastores:GetDataStore("DataStore")
local players = game:GetService("Players")
players.PlayerAdded:Connect(function(player)
local dictionary = {}
local success1, result1 = pcall(function()
return datastore:UpdateAsync(game.GameId, function(data)
data = data or {}
data[player.UserId] = true
dictionary = data
return data
end)
end)
if success1 then
if result1 then
print(result1)
for key, value in next, dictionary do
local success2, result2 = pcall(function()
return players:GetNameFromUserIdAsync(key)
end)
if success2 then
if result2 then
print(result2)
end
else
warn(result2)
end
end
end
else
warn(result1)
end
end)
local datastores = game:GetService("DataStoreService")
local datastore = datastores:GetDataStore("DataStore")
local players = game:GetService("Players")
players.PlayerAdded:Connect(function(player)
local dictionary = {}
local success1, result1 = pcall(function()
return datastore:UpdateAsync(game.GameId, function(data)
data = data or {}
data[player.UserId] = player.Name
dictionary = data
return data
end)
end)
if success1 then
if result1 then
print(result1)
for key, value in next, dictionary do
print(key, value)
end
end
else
warn(result1)
end
end)