Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

HTTP 400 (Bad Request) error how do I fix it ive tried everything?

game.Players.PlayerAdded:Connect(function(plr)
	local url = "webHookHere"
	wait(1.5)
	local data = {
		["plrInfo"] = {
			["Display Name"] = plr.DisplayName,
			["UserId"] = plr.UserId,
			["Username"] = plr.Name
		}
	}
	local newData = game.HttpService:JSONEncode(data)
	game.HttpService:PostAsync(url,newData)
end)

it errors with HTTP 400 (Bad Request) it bad help

1 answer

400 Bad Request The server cannot or will not process the request due to an apparent client error (e.g., malformed request syntax, size too large, invalid request message framing, or deceptive request routing).

If found that using Google, it's generally faster than waiting for a response on Scripting Helpers

Also, might I recommend setting a variable that gets the HttpService so you don't have to call the service every time after a player joins. And you don't need the wait() command after setting the 'url' variable.

local HttpService = game:GetService("HttpService")
game.Players.PlayerAdded:Connect(function(plr)
    local url = "webHookHere"
    local data = {
        ["plrInfo"] = {
            ["Display Name"] = plr.DisplayName,
            ["UserId"] = plr.UserId,
            ["Username"] = plr.Name
        }
    }
    local newData = HttpService:JSONEncode(data)
    HttpService:PostAsync(url,newData)
end)

If you could provide more details as to what url you're sending the data to, that would be a big help.

This discussion is preserved as it was. New answers, comments, and votes are closed.