It’s right in the title. I’ve tried taking a look at other posts and I’m just not grasping it! This is my first time attempting to setup proxies as well as make them suitable for this exact scenario.
My objective is to be able to communicate with Roblox API to recall the last time a player was online (as in on Roblox). Unfortunately, you can’t directly request that from Roblox, but rather work through a proxy.
I may need a complete rundown or walkthrough, as I am honestly completely lost. This is essential for what i’m trying to do.
The Rolimon’s API can provide with useful information about different Roblox users, including the time they were last online. As far as I know, this is the only way to do this for now. The only flaw with this is that Rolimon’s only has users that have limited’s under their account or have been manually added to the website. If this won’t be an issue for you then you can try the following.
The link under Rolimon’s API is my Roblox users information, you should see “last_online” with a timestamp of when the user was last on the Roblox website in the epoch format. I’ve created a module that can provide you with with those numbers.
You can convert the numbers returned from the API with this function:
local function getUserOnlineStatus(userId)
local data = {
userIds = {
userId,
}
}
local success, result = pcall(function()
return http:PostAsync(baseUrl,http:JSONEncode(data))
end)
if success then
if result then
local decodesuccess,decodedresult = pcall(jsonDecode,http,result)
if decodesuccess then
if decodedresult then
return decodedresult
else
warn(decodedresult)
end
else
warn(decodedresult)
end
else
warn(result)
end
else
warn(result)
end
end
print(getUserOnlineStatus(1).lastOnlineTimestamps[1].lastOnline) -- returns an ISO date thingy
I’m aware of how to use the HTTP service and communicating with API. My problem is getting that online data from an API or from Roblox but I can’t directly request it from them. I need to work through a proxy unfortunately.
local proxyUrl = "roproxy.com"
local baseUrl = "https://presence."..proxyUrl.."/v1/presence/last-online"
Also here’s the full script:
local http = game:GetService("HttpService")
local jsonDecode = http.JSONDecode
local proxyUrl = "roproxy.com"
local baseUrl = "https://presence."..proxyUrl.."/v1/presence/last-online"
local function getUserOnlineStatus(userId)
local data = {
userIds = {
userId,
}
}
print(http:JSONEncode(data))
print(userId)
local success, result = pcall(function()
return http:PostAsync(baseUrl,http:JSONEncode(data))
end)
if success then
print(result)
if result then
print(result)
local decodesuccess,decodedresult = pcall(jsonDecode,http,result)
if decodesuccess then
if decodedresult then
return decodedresult
else
warn(decodedresult)
end
else
warn(decodedresult)
end
else
warn(result)
end
else
warn(result)
end
end