Hello, im using the Hyra Service and wanted to make Screens ingame to show the Sessions that are starting soon. I already got the Session Data in Roblox but now i wanna also use the Data. I already tried much stuff and the support from Hyra said im not far from finishing but helping me with that is not their Support Stuff. Please help me someone
for I, V in pairs(Screens:GetChildren()) do
if V:IsA("Part") and V.Name == "Screen" then
local Response = HTTPService:RequestAsync({
Url = "https://api.hyra.io/activity/sessions/"..WorkspaceID.."/upcoming",
Method = "GET",
Headers = {
["Authorization"] = "Bearer "..ApiKey
},
})
for _, Session in pairs(Response) do
print(Session)
print(Session.data)
end
end
end
Based on previous replies, you want just the name and start offset, right? So something like this:
Response = HTTPService:JSONDecode(Response.Body)
for _, Session in Response do
local Name, Start = Session.schedule.name, Session.schedule.public_start_offset
-- ...
end
Note that, as your code doesn’t already have it, you might want to add additional error checking and assertion. HTTP requests, even (probably) JSONDecode can sometimes fail, so it’s good practice to wrap them in pcalls and catch the errors.