http request on client roblox code example

Example: roblox http request

local HttpService = game:GetService("HttpService") local URL_ASTROS = "http://api.open-notify.org/astros.json" -- Make the request to our endpoint URLlocal response = HttpService:GetAsync(URL_ASTROS) -- Parse the JSON responselocal data = HttpService:JSONDecode(response) -- Information in the data table is dependent on the response JSONif data.message == "success" then	print("There are currently " .. data.number .. " astronauts in space:")	for i, person in pairs(data.people) do		print(i .. ": " .. person.name .. " is on " .. person.craft)	endend

Tags:

Misc Example