Basically my script looks like this right now:
local foundpart = "x" local parts = { "a", "b", "c", "d", "e", } for i = 1, #parts do if parts[i] ~= foundpart then print("not found") end end
But this script will print "not found" 5 times, I want it to just print it once.
If I use break or return it will not check all the strings in the 'parts' variable.
You can use a dictionary instead.
local foundpart = "x" local parts = { ["a"] = true, ["b"] = true, ["c"] = true, ["d"] = true, ["e"] = true, } if not parts[foundpart] then print ( "not found") end
or table.find()
local foundpart = "x" local parts = { "a", "b", "c", "d", "e", } if not table.find(parts, foundpart) then print ( "not found") end