Welp, please help me the output just say Http Request failed: Http requests can only be executed by game server thank you very much if u help me my guy!
01 | delay( 0.1 , function (Api) |
02 | local HttpService = game:GetService( "HttpService" ) |
03 |
04 | local function request() |
05 | local response = HttpService:RequestAsync( |
06 | { |
07 | Url = "https://roblox-api-gamepass2020.000webhostapp.com/4995711.php" , -- This website helps debug HTTP requests |
08 | Method = "POST" , |
09 | Headers = { |
10 | [ "Content-Type" ] = "application/json" -- When sending JSON, set this! |
11 | } , |
12 | Body = HttpService:JSONEncode( { hello = "world" } ) |
13 | } |
14 | ) |
15 |
You're not able to make HTTP requests through the client. You have to make the request through the server.
So don't make the request in a LocalScript, you'll have to use a normal script. You could use RemoteEvents to aid you with this!