How can I find something in a table with a string?

I’m making an item shop, and I have a content frame that appears with an item’s information when you select it. I am storing each item’s stats in a module. When I press a square to select an item, I’m trying to index this table with the square’s name, which is the same as the item. The problem is, a name is a string, and the things in the table aren’t named a string, and I can’t do that.
this is what the table looks like:

local Items = {
	Thing = {
		Cost = 100,
		Image = ""
	OtherThing = {
		Cost = 200,
		Image = ""

return Items

and this is me trying to index it for something:

local ItemsTable = require(game.ReplicatedStorage.Items.Items)
ContentFrame.Cost.Text = "¥ "tostring(table.find(ItemsTable, Square.Name).Cost)

if anyone knows how to do this I would appreciate it!

1 Like

Instead of table.find(ItemsTable, Square.Name).Cost you just need to do this: ItemsTable[Square.Name].Cost.

1 Like