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

PostAsync not working and not outputting anything?

hs = game.HttpService

game.Players.PlayerAdded:connect(function(plr)
	local success = hs:PostAsync("https://intrance.com, "name="..plr.Name.."&age="..plr.AccountAge,2)
	if not success then
		print("Failed")
	else 
		print("Success")
	end
end)

This isn't outputting "Failed" nor "Success" nor an error. What am I doing wrong? Thanks.

1 answer

You should pcall the function. If your website is down at that time when you post, your script will error preventing further usage.

You also got some of your code mixed up. :)

NOT TESTED AS ON TABLET

hs = game:GetService("HttpService")

game.Players.PlayerAdded:connect(function()
        success,message = pcall(function()
                html = hs:PostAsync(http://intrance.com, "name=".. plr.Name.."&age=".. plr.AccountAge, 2)
        end)
        if not success then
                print("ERROR: "..message)
        else
                print("SUCCESS")
               -- print(html)
               -- The code above will print the HTML code of your website.
        end
end)

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