MessagingService:PublishAsync(): Cannot publish Array, can only accept valid UTF-8 characters

Using Cmdr to make a ban system. Followed a video’s instructions, and tried integrating it into Cmdr.
Everything should be working fine, but then it got this error,

This is the line of code responsible:
image

plrdata is a table containing the username and reason for the ban:

{
  [1] = Xanthys,
  [2] = "exploiting"
} 

I don’t know how else I can describe this problem, so heres the full code:
image

Could you show the client module of the command? I feel like the “player” is not a player name, but a player/array of players.

Well at first it was players, but I changed it to player
image

Yeah, then it’s not a player name, but rather the Player object itself. So therefore, you are trying to send it via MessagingService… You need to do player.Name to get the name

1 Like

Well it worked, but there’s a new error now.

ServerScriptService.Cmdr.Commands.banServer:23: attempt to get length of a Instance value

Not too sure what it’s talking about, since line 23 is:

return ("Banned %d player for: "..reason):format(#player)

Acutally wait, it could probably be because it doesn’t use players anymore.

Right now you are only banning one player, so therefore this statement is really unnecessary. Basically it’s saying you’re trying to use the length operator on an Instance, which is not how it’s used… You could just do
return "Banned player for: " .. reason

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.