How to detect if a curtain name is equal to a module table name?

I can’t attend to figure out how to solve this issue and make it work. Here is what I am trying to accomplish:

Module:

Screenshot 2022-10-30 002148

ServerScript:

How do I check if the module has a table equivalent to the Data.ItemName.Value??

Try doing if ButtonInfoModule.Info[Data.ItemName.Value] then

Assuming I have a module layout like this:

local ButtonInfo = {}
ButtonInfo.Info = {
	["ExampleName"] = {
		Price = 25,
		String = "Hello, world!"
	}
}
return ButtonInfo

You would probably be fine with doing something like this:

local Module = require(game.ReplicatedStorage.ModuleScript)

for _, v in pairs(workspace.Folder:GetChildren()) do
	if Module.Info[v.Name] then
		print(Module.Info[v.Name]) -- assuming, in my case ExampleName is a value in that folder, the data will print.
	end
end
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.