JSON Formatting gone wrong

So, I’m working on this script right here that’s meant to ban a player that commits an infraction automatically and log it on the discord appropriately, it keeps saying Error 400 Bad Request, which usually reffers to formatting, but I’m literally copying the same exact arguments from another script and that other script works, can any of you guys spot any wrong JSON formatation?

local exploitevent = game.ReplicatedStorage.Events.Admin.Admin

local TrelloAPI = require(game.ServerScriptService.Modules.TrelloAPI)
local BoardID = TrelloAPI:GetBoardID("Guarulhos RP - Banlist")
local banlist = TrelloAPI:GetListID("Bans", BoardID)

local APIModule  = require(game.ServerScriptService.Modules.WebhookAPI)
local newWebHook = APIModule.new("webhook ID is placed here properly")

--//

exploitevent.OnServerEvent:connect(function(player, motivo, lugar)
	
newWebHook:post{
			username = "GuaruBOT",

			['embeds'] = {
				{	
				['title'] = '**Player Banido**',
				['description'] = 'Um jogador foi banido.',
				['color'] = 16711680,
				
				['fields'] = {
					{
					['name'] = 'Moderador',
					['value'] = 'SISTEMA',
				},
				{
					['name'] = 'Jogador',
					['value'] = player,
				},
				{ 
					['name'] = 'Motivo',
					['value'] = motivo,					
				}
				}
				}
			}
}		

	TrelloAPI:AddCard(motivo, player.. '**[Este ban foi executado pelo sistema, o úsuario tentou modificar ou disparar o evento: '..lugar..']**', banlist)

end)
1 Like

I don’t think you can send a player datastructure, it has to be something that’s JSON convertable like a string or a number (Probably want to use UserId instead)

1 Like

No. They’re equivalent statements. The only time this change matters is when the key is expected to be a non-string value.

This is entirely correct though!

1 Like

The username formatation is correct cause that’s how the module tells you to do, also I’m not sending a player’s datastructure, it’s only his name.

No, you’re passing the player’s instance, not the name.

player is defined as the player who fired the Remote Event.

If you would want to use the name use player.Name

2 Likes

That player variable is a player datastructure, not a number or a string though.

1 Like

Ah, I clearly see the problem here, I’m telling the server one variable and he automatically receives other. I’ll address that and it’ll hopefully work, thanks for both of you guys.

You should give the Solution to @Korvbagarens. I only iterated his answer and so it is more just for him to have it.

1 Like