How to use [] problem

I need to hwo these works I tought, I could get things form a module script like this

module.table[v.Name].itemName

and I thought tought that would work for every thing, but it doesnt work for anything so pls help me how I can do something like this

What exactly are you trying to achieve are you just trying to require the ModuleScript

well lets say I need to know the price off an item, all the information I have stored in a module script so I need to acces it but I was in a for loop so I need to v.Name how do I use V.Name for something like that?

How is the data stored? is there a table Table inside of the ModuleScript?

yes theres a table in the module and tehres the price normaly I would do module.table.upgrade1.price, but I dont have upgrade 1 it could be upgrade 3 so that why its v.Name

You can use table.find(table here, v) to find the int of items

but is there even a way to do what I was saying that would be way easyer

Assuming that there is a table within the module script called table, then that should work. If not, then either the module script is failing, or the data is not being correctly stored.

no its not called table, its like this module[v.Name].price

Okay makes sense. You have a dictionary and that dictionary has each item like [ā€œupgradenumā€] = {[ā€œpriceā€] = {};} etcā€¦ so that5 means you can use module[v.name] perfectly fine can you show your script?

these are some other ones there the same exactly

upgradeInfoFrame.Title.Text = upgradeModule[v.Name].title
upgradeInfoFrame.Description.Text = upgradeModule[v.Name].description

this is the error: attempt to index nil with ā€˜titleā€™

Could you share the module script code?

local module = {
	Upgrade1 = {
		title = "Beginner!",
		description = "Your first upgrade! This will grant you +250,000 more numbers to choose from!",
		price = 500000
	}
}

return module

This could be similar to finding a instance value instead of the value inside of itā€¦ if your code looks like what I showed may he try title[1] insteadā€¦ Iā€™m not the most qualified person but maybe thatā€™ll work

Ohhh Iā€™m stupid sorry do module[v.name][title] (and maybe what I also said sorry)

if I do [v.Name][title] theres an error under title maybe these ā€œā€ fix that?

Judging by that script, Your v.Name is not in the table otherwise it should work. Could you do print(v.Name) and show us what gets printed.

1 Like

idk how but suddenly the post work like this [v.Name].title

it already works ty but will this also work for workspace so like

game.Workspace[v.Name]

Yes, That should work assuming that v.Name is within the workspace.