**I want to insert a table in a table but I don’t know how to do it **
**I print my table but thats not a table in a table thats just 1 table with my values and the name of my auras
** Include screenshots / videos if possible!
**I tried the to find solutions on the dev hub but none worked so if you can help me Ill appreciate it **
In the case of you only needing one value in the dictionary, couldn’t you just not use a dictionary? You can just define a value in the table as QualityControl said.
local tbl = {}
tbl["BasicBee"] = 0 (change to your value of the player)
tbl["BomberBee"] = 0 (change to your value of the player)
tbl["BraveBee"] = 0 (change to your value of the player)
tbl["HastyBee"] = 0 (change to your value of the player)
When the player load I have an inventory system with a limit and when the player load I want to know the amount of bee the player have thats why I want this table
local function saveAmountAuras(player)
local AurasValues = player.AurasValues
if not AurasValues then
warn("AurasValues not found for player "..player.Name)
return
end
local AuraAmount = AurasValues:GetChildren()
local auraName = {}
local AuraValues = {}
for _, aura in ipairs(AuraAmount) do
if aura:IsA("IntValue") then
table.insert(auraName, aura.Name)
table.insert(AuraValues, aura.Value)
table.insert(auraName, AuraValues)
print(auraName)
end
end
local success, errorMsg = retryOperation(function()
AmountAuraData:SetAsync(player.UserId, auraName)
print("saved")
end)
if not success then
warn("Failed to save auras for player "..player.UserId..": "..errorMsg)
end
end
cause I need to get the auraName and not a pretable idk if im clear im sorry im a beginner
In this case, the code in the function would look like:
local function saveAmountAuras(player)
local AurasValues = player.AurasValues
if not AurasValues then
warn("AurasValues not found for player "..player.Name)
return
end
local auras = AurasValues:GetChildren()
local auraAmounts = {}
for _,aura in ipairs(auras) do
if not aura:IsA("IntValue") then continue end
auraAmounts[aura.Name] = aura.Value -- Save the quantity of auras with the aura's name
end
local success, errorMsg = retryOperation(function()
AmountAuraData:SetAsync(player.UserId, auraAmounts)
print("saved")
end)
if not success then
warn("Failed to save auras for player "..player.UserId..": "..errorMsg)
end
end