Table.find not finding string with humanoid:GetAccessories()

Title says it all, even though when printing values from the table and the string, they’re identical, table.find doesn’t find it.

local index = table.find(plr.Character.Humanoid:GetAccessories(), hat)
		if index then print("d")
			else
			print(hat)
			print(plr.Character.Humanoid:GetAccessories()[1])

When you pass an instance as an argument to the global print() the name of that instance will be displayed in the console, do not be confused however, this isn’t the same as passing the string value stored/held by the “Name” property of that same instance to print(), even if both print calls result in the name of the instance being displayed to the console.

I can’t really decipher much from the provided script so I can only assume that you’re attempting to search for a string value (the value associated to the “Name” property of some instance) within an array of object values (instances).

1 Like

I already figured it out, GetAccessories() just wont run if the character isn’t wearing any accessories