HTTP 400 on submitting a log?

  1. What do you want to achieve?

I want to log attendances on my discord server.

  1. What is the issue?

Sup y’all again! I have been trying fix this issue for the last 2 hours, the script I made It’s supposed to submit an embed to my discord showing how many minutes the user has been logged. It submits upon the player unlogs. However, It keeps trowning a HTTP 400 error.

Maybe I’m not seeing something, so that’s why I need feedback.

  1. What solutions have you tried so far?

Changing the locations of the script, etc. I don’t think Discord is blocking Roblox request. It must be the code.

Login.ClickDetector.MouseClick:connect(function(player)
	local Data = {
		["contents"] = {
			["embeds"] = {{
				["type"]= "rich",
				["title"] = "Hosting Ended ",
				["description"] = "TEST",
				["color"] = 006798,
				["thumbnail"] = "https://www.roblox.com/headshot-thumbnail/image?userId="..player.UserId,
			}}
		}}
	if Player_Name and Time and Login then
		if inuse == false then
			NotifyOn.Value = true
			NotifyM.Value = player.Name.." is now hosting!"
			inuse = true
			PlayerText.Text = "Host: "..player.Name
			Image.Image = "https://www.roblox.com/headshot-thumbnail/image?userId="..player.UserId.."&width=100&height=100&format=png true"
			Time.UI.Text.Text = "0"
			script.Current.Value = player.Name
			Login.UI.Text.Text = "SIGN OUT"
			Count.Disabled = false
			Count1.Disabled = false
			Main_Script.Disabled = false
			Current.Value = player.Name
			wait(3)
			NotifyOn.Value = false
			NotifyM.Value = ""
		elseif inuse == true and player.Name == Current.Value then
			inuse = false
			PlayerText.Text = "Nobody is hosting! Last host: "..player.Name
			Time.UI.Text.Text = "0"
			Image.Image = ""
			Count.Disabled = true
			Count1.Disabled = true
		    script.Current.Value = ""
			Login.UI.Text.Text = "SIGN IN"
			Main_Script.Disabled = false
			HTTP:PostAsync(URL, HTTP:JSONEncode(Data))
		    wait(2)
		    Time.UI.Text.Seconds.Value = 0
		    Time.UI.Text.Minutes.Value = 0
		end
	end
end)

I’ll be always glad for your answers! :smiley:

It’s “content”, not “contents”. Embeds are also a separate field from the content, so I’m not sure why you put that inside content.

2 Likes

You can not have the embeds field inside the content field.

See the solution on this post as a reference. How do you make a discord webhook send an embed message?

1 Like

Thank you so much, I was too blind to notice it.