Script not sending to webhook

I am making a quiz centre which auto-ranks people. It’s all working, except the feature which sends to the webhook. Without it being under all the ranking stuff it works, but when it’s in the place it is, it doesn’t work.

Variable:

local data = 
	{
		["content"] = "",
		["username"] = "Tetra Ranking Services",
		["avatar_url"] = "https://cdn.discordapp.com/icons/966031787757289483/d061db97cab4f5b2a8b010bed33b6840.webp?size=96",
		["embeds"] = {{
			["title"] = "Quiz Submitted",
			["description"] = "A user has successfully submitted a new quiz via the Quiz Centre.",
			["type"] = "rich",
			["color"] = tonumber(0x000000),
			["footer"] = {
				["text"] = "Powered by Tetra",
				["icon_url"] = "https://cdn.discordapp.com/icons/966031787757289483/d061db97cab4f5b2a8b010bed33b6840.webp?size=96"
			},
			["fields"] = {
				{
					["name"] = "Username",
					["value"] = "drilinz",
					["inline"] = false
				},
				{
					["name"] = "Status",
					["value"] = "Passed",
					["inline"] = false
				},
				{
					["name"] = "Score",
					["value"] = "6/10",
					["inline"] = false
				},
				{
					["name"] = "Account Age",
					["value"] = "14678 days",
					["inline"] = false
				}
			}
		}}
	}

Script:

game.ReplicatedStorage.submitApplication.OnServerEvent:Connect(function(plr)
	if plr.correctQuestions.Value >= pointsToPass then
		local url_with_data = url.."?user_name="..plr.Name.."&key="..apiKey.."&groupid="..groupId.."&role_number="..targetRank
		local response = httpService:GetAsync(url_with_data)
		local data = httpService:JSONDecode(response)
		if data.status == "The user had their rank changed" then
			local finalData = httpService:JSONEncode(data)
			httpService:PostAsync(webhookURL, finalData)
		end
	end
end)
1 Like

I see you are using discord urls in your webhook array, So I will assume you are sending this to discord’s webhook endpoints. Discord does not accept webhook requests from Roblox’s servers.

I found the issue, it was because the status wasn’t decoding “The user had their rank changed”.