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!

3 comments

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

0

args[num] is nil, it sets message to nil, and next time around message is nil and nil ~= ""

0

Could you show me how to do that?