How to tell if a tag name is the same as a model name

Hi, im creatinga system that involves that when a player clicks a button it goes through the characters accessories then it also loops through workspace through all models. if the accessory contains a certain tag that is the same name as a model in workspace it then sets the model to transparency = 1. Im needing this to work without specifying the name as it can be used for multiple accesories.

heres a screenshot of where stumbled and got lost. this is my third attempt on this…

Please let me know if you want me to explain more.

Try removing the second for loop and just putting this after the if statement:

if i.Name == tag.Name then
–stuff here
end

Sorry I am a little confused as to what you’re asking but I hope this helps

if i.Name == model.Name and i:IsA("Accessory") then
	model.Transparency = 1
end

this is if you want to check for names. If you want to check if they have a tag you could do the following:

if i:HasTag(model.Name) and i:IsA("Accessory") then
	model.Transparency = 1
end

This is probably easier done with events though, then pass the name of the model as a parameter.

Hope this helps