I have a command where I want to make it so high ranks in my game can self assign different tasks and if their message contains any of the strings within a table to run code. I have been trying to do this for a while but the for loop I am using to go through the table doesn’t seem to be working. It keeps returning nil rather than the specific value of the table which leads me to believe the i value isn’t actually iterating through all of the values. If anyone could help I would appreciate it, here is the code I use. The error was invalid argument #1 to find, string expected, got nil.
local Duties = {"answering calls", "patrolling first floor", "patrolling second floor", "ranking players", "assigning duties"}
for i,v in pairs(Duties) do
if string.find(Duties[i],Message) then
AssignedDuty = Duties[I]
end
end