How to check if a certain word is in a name of an object

I have things named object1, object2, object3, and so on but in a script, I want to see if a name of an object has the word object in it. How would I do that?

Use string.match, it’ll return nil if the string is not found.

local foundWord = string.match(object1.Name, "object")
1 Like