Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
ym5a 52
2 years ago
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

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

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.

Ad

Answer this question