I need help with unable to cast value to Object

player.ItemEquipped is a String Value, i did tried remove the tostring and it still not work
equipment is a folder
I also tried to use FindFirstChild, It gave same error

if CollectionService:HasTag("Unbreakable", equipment[tostring(plr.ItemEquipped.Value)]) then

You need to switch the order of your arguments. As shown on the documentation for HasTag, the instance comes first, then the tag.

Any time you see this sort of error, it’s usually a good sign that you’re trying to pass a non-object to an API that expects an object.

And also the tostring can be removed if you’re using a StringValue.

1 Like