String to instance

menu for defining tableloc isn’t defined.

it doesn’t matter, no one uses array for saving in a table for locating

But defining variables does matter? Especially when they error your code…

it errors I’m almost positive because its a string and not an instance,

The attribute is of a string type, correct?

for i,menu in pairs(menus:GetChildren()) do
	local menu = tostring(menu.Name)
	menuList[menu] = menu
	print(menuList)
end

show me the output of this code

yes its called “menuTest”, which is the same as the frame in my menus folder

I guess try this.

wat

show me the table which was printed

as you see now, the name is there for the menu instance object, now using it you can locate

Change tableloc to this and try.

local tableloc = menuList[direction]
local function directButton(direction)
	print("connected")
	print(direction)
	local tableloc = menuList[direction]
	print(tableloc)
	print(menuList[direction])
	print(tableloc)
	menuList[direction].Visible = true
end

local function directButton(direction)
	print("connected")
	print((tostring(direction))
	local tableloc = menuList[tostring(direction)]
	print(tableloc)
	print(menuList[direction])
	print(tableloc)
	menuList[direction].Visible = true
end

try this

rip

1 Like