How to add string value to a key within a dictionary?

Now obviously you can’t perform arithmetic on strings I know my error, but I was wondering what the alternative would be given I know how to do it manually but this needs to be done automatically.

–Services
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local ServerStorage = game:GetService(“ServerStorage”)

–Modules
local DataStore2 = require(ServerStorage:WaitForChild(“DataStore2”))

–Locals

–Bind to clickDetector.MouseClick
script.Parent.MouseClick:Connect(function(player)
–Localize fruitName, destroy fruit (debounce)
local itemName = script.Parent.Parent.ItemName.Value
script.Parent.Parent:Destroy()

--Get inventoryStore, updateInventoryStore
local inventoryStore = DataStore2("Inventory2", player)
inventoryStore:Update(function(currentTable)

		currentTable["Inventory"] = currentTable["Inventory"] + itemName -- temName is the object added to the inventory.

	--MUST return updated table
	return currentTable
end)

end)

Table[AnotherTable][String] = value
You should use .. instead of +. You can’t add strings to strings using +.
More information: How to Concatenate Strings in Lua

So in this instance it would be
currentTable[Inventory][itemName] = currentTable[Inventory][itemName]…itemName ?
Or how would I format this

Edited my post.
Have a look. (:slight_smile:

But, in this case.
You want to add the name to the table I assume.

So, here’s one way you can do that:

table.insert(Table, InventoryItemString)