Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

New Custom Admin Commands Not Working On Any Commands Due To GetReason Function?

Asked by
LuaDLL 253 Moderation Voter
5 years ago

This script was given to me by RedcommanderV2, but I get an error when calling a command that i have inserted to the script after i editted it to call commands.

This part errors:

local function FindReason(MsgWords, StartNumber) 
    local Reason = {}
    for index, word in pairs(MsgWords) do
        if index >= StartNumber then
            table.insert(Reason, word)
        end
    end
    return(table.concat(Reason, ' '))
end

The Part That Calls It:

local Value = FindReason(MsgWords[3]) or ''

Error: ServerScriptService.Admin:76: bad argument #1 to 'pairs' (table expected, got nil) Stack Begin Script 'ServerScriptService.Admin', Line 76 - upvalue FindReason Script 'ServerScriptService.Admin', Line 172 Stack End

Any Help Would Be Appreciated!

0
In your first code block, MsgWords is supposed to be a table that the for-loop on line 3 goes through. The other block should be the table "MsgWords" not the value of the key you are indexing. xPolarium 1388 — 5y

Answer this question