How do i find a table inside another table

im making a HUD and i want the face to change based on the character selected

local Images = {
	Pwner = {
		Normal = "87810997681391",
		Damaged = "107950777907834",
		Hurt = "93480301836805"
	},
	B0mbr = {
		Normal = "87810997681391",
		Damaged = "107950777907834",
		Hurt = "93480301836805"
	},
	Spy = {
		Normal = "131651159645827",
		Damaged = "125807671900092",
		Hurt = "108656104947961"
	},
	Nil = {
		Normal = "81714598881008",
		Damaged = "102301173276265",
		Hurt = "92436767183714"
	},
}

function ChangeFace(Face)
	local Class = Classes["EquippedClass"]
	print(Class)
	print(Images)
	print(table.find(Images,Class))
	if table.find(Images,Class) == nil then
		Class = "Nil"
	end
	DisplayImage.Image = "rbxassetid://" .. Images[Class][Face]
end

table.find still returns nil, the class’ name and the name of the table are the same too.

cause table.find only works with arrays, either iterate trough your dictionary, or flatten it and then use table.find

→ Images[Class] will work, since the key is the class

1 Like

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