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?
1 Like
Use string.match, it’ll return nil if the string is not found.
local foundWord = string.match(object1.Name, "object")
12 Likes
Do you have to specify object1?
I assume object1 is a variable for an instance. The first parameter is just the string you want to search through.
2 Likes
ohh ok object1 is a part but I get it now
Hey I want to search the players inventory for something with “Ram” in its name but it does not work I think I got the params wrong could you help?
Code: if string.match(Inventory, "Ram") then
This doesn’t concern the original poster so you may want to make your own thread for this.
1 Like