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

Cant use RequestAsync for my table to ban player?

Asked by 5 years ago

This is my code in ServerScriptService What I want to do is using the website Pastebin.com for my table to Async the text that is writen on http://pastebin.com/raw/U6evjXx5/ it is my name on there and I should be banned from the game but I doesnt work maybe there is a fix for it?

game.Players.ChildAdded:connect(function(player)
local HttpService = game:GetService("HttpService")
 local function request()
    local response = HttpService:RequestAsync(
        {
            Url = "https://pastebin.com/raw/U6evjXx5",
            Method = "POST",
            Headers = {
                ["Content-Type"] = "application/json"
            },
            Body = HttpService:JSONEncode({hello = "world"})
        }
    )
local Banned_Players = {response.Body}
for i,v in pairs(Banned_Players) do
print(unpack(Banned_Players))
if player.Name == v then
player:Kick()
wait(1)
if response.Success then
print("Successfully received data")
else
print("The request failed:", response.StatusCode, response.StatusMessage)
end
end
end
end

local success, message = pcall(request)
if not success then
print("Http Request failed:", message)
end
end)


Answer this question