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

Custom Admin Commands, Kick command wont work due to getfullmessage?

Asked by
LuaDLL 253 Moderation Voter
5 years ago
Edited 5 years ago

The getfullmessage function:

function getfullmesssage(args)
    local Message = ""
    local num = 2
    for i,v in pairs(args) do
        if Message == "" then
            Message = args[num]
            num = num + 1
        elseif Message ~= "" then
            Message = tostring(Message.." "..args[num])
            num = num + 1
        end

    end
    return Message
end

kick function:

kick = function(arg,caller)
    local Player = getPlayerFromTxt(arg[1])
    if Player then
        local Message = getfullmesssage(arg)
        Player:Kick(Message)
    end
end;

Error: ServerScriptService.Admin.AdminCommands:87: attempt to concatenate field '?' (a nil value) stack Begin script 'ServerScriptService.Admin.AdminCommands', Line 87 - Global getfullmessage script 'ServerScriptService.Admin.AdminCommands', Line 208 - field ? script 'ServerScriptService.Admin.AdminCommands', Line 70 - field parse script 'ServerScriptService.Admin.AdminCommands', Line 8 Stack End

Line 208:

local Message = getfullmesssage(arg)

Line 87:

Message = tostring(Message.." "..args[num])

Line 70: (Works, just calls the kick function)

m.Commands[command](arguements,player)

Line 8: (Works, just gets the player and command)

m.parse(msg,player)

Any help would be appreciated!

0
there is a problem with your getfullmessage function, the argument args is only representing the first argument, you have to use the ellipsis ... to get all the arguments theking48989987 2147 — 5y
0
args[num] is nil, it sets message to nil, and next time around message is nil and nil ~= "" User#22604 1 — 5y
0
Could you show me how to do that? LuaDLL 253 — 5y

Answer this question