Ex: I am trying to add something in table1 to table2 then print the results In lines 30, 42,48 are where I use this example it adds xpLvlTable to the table that is stored in 'DataStore'
-- Variables
local xp_lvlDataStore = game:GetService('DataStoreService'):GetDataStore('xp/lvlStore')
local repStorage = game:GetService('ReplicatedStorage')
local xpChanger = repStorage:WaitForChild('Xp_LvlChanged')
local xpToAdd = 5
local part = script.Parent
local maxLvl = 350
-- Events
pcall(part.ClickDetector.MouseClick:Connect(function(plr)
-- Defines xp and lvl
local key = 'Player-'..plr.userId
local xpLvlTable = xp_lvlDataStore:GetAsync(key)
local curXp = xpLvlTable[1]
local curLvl = xpLvlTable[2]
print('serverCurXp = '..curXp)
print('serverCurLvl = '..curLvl)
-- Fire to player
xpChanger:FireClient(plr,xpToAdd)
-- Math
local newLvl = curLvl + 1
local newXp = curXp + xpToAdd
local lvlEquation = 10*curLvl
print('ServerNewXp = '..newXp)
-- Adds lvls and sets xp
if curLvl == 0 and newXp >= 10 then
print('Saving 1st lvl')
local new_xpLvlTable = {1,(xpToAdd - 10)}
wait(6)
xp_lvlDataStore:IncrementAsync(key,(new_xpLvlTable))
print('Saved')
elseif curLvl >= maxLvl then
print('Saving maxLvl')
local xpLvlTable = {0,350}
wait(6)
xp_lvlDataStore:SetAsync(key,(xpLvlTable))
print('Saved')
elseif lvlEquation <= newXp and lvlEquation ~= 0 then
print('Saving Lvled Up')
local xpLvlTable = {1,xpToAdd - lvlEquation}
wait(6)
xp_lvlDataStore:IncrementAsync(key,(xpLvlTable))
print('Saved')
else
print('Saving Did not lvl up')
local xpLvlTable = {curLvl,xpToAdd}
wait(6)
xp_lvlDataStore:IncrementAsync(key,(1))
print('Saved')
end
end))
I meant to use one table and its numbers that are in it to be added to the numbers inside the second table

2 comments
I meant to use one table and its numbers that are in it to be added to the numbers inside the second table
Added as in operationally? Like 3 + 5 so the result is 8? Or add as in concatenate the contents of the table?