You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
i want to have a table and then add many tables to it
-
What is the issue? Include screenshots / videos if possible!
the issue is that it dosen’t add it just replace -
What solutions have you tried so far? Did you look for solutions on the Developer Hub? i tried to add in many ways
i have a code that adds and then i just have a code that print the data
this code adds the tables
local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("ServersDS")
local value = 1
local value1 = 1
wait(5)
local Data = DataStore:GetAsync(value.."-Servers")
print(Data)
--if Data ~= nil then
--print("data is not nil")
--print(#Data)
--for i=1,#Data do
-- value1 += 1
-- print(value1.."iiiiiiiiiiiiiiiiiiiiiiiiiiiiii")
--end
--end
for key, _ in pairs(Data) do
value1 += 1
print()
end
--print(value1)
local info = { ["server"..value1] = {value1,game.Workspace.values.Res.Value,
game.Workspace.values.players.Value,
game.Workspace.values.Code.Value,
game.Workspace.values.track.Value,
game.Workspace.values.map.Value,
game.Workspace.values.cartype.Value,
game.Workspace.values.public.Value}}
--Data["server"..value1] = info
table.insert(Data,info)
print(Data)
game.Workspace.values.Key.Value = "server"..value1
--table.insert(Data,info)
--local info = Data
--print(Data)
--print(info)
DataStore:SetAsync(value.."-Servers", Data)
--print(Data)
--end
-- info["server"..value1] = nil
game:BindToClose(function()
print("server shutdown")
DataStore:SetAsync(value.."-Servers", info)
end)
this code is the code where it just prints the data
local value = 1
local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("ServersDS")
while true do
local Data = DataStore:GetAsync(value.."-Servers")
print(Data)
wait(10)
end
the data is first {
[“server1”] = ▼ {
[1] = ▼ {
[“server1”] = {}
}
}
} becuase i set it so in another script but then later its {
[1] = ▼ {
[“server2”] =
{…}
}
why
also feel fre to ask for more info i just want to get help on this
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.