I will take a look, and get back to you.
Still open to other peoples responses though on helpful information.
I will take a look, and get back to you.
Still open to other peoples responses though on helpful information.
I like this, but I still need something more for grabbing absolutely a random player off of Roblox without necessarily being on Rolimon’s.
Bumping this topic…
Any other help?
Here’s a scirpt that might help:
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.
Just use roproxy, it worked perfectly for me…
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
I’m pretty sure I’ve tried this very method (this api), and it did not work.
Can you test it right now, and let me know if it works still?
I tested it out, its a feature in my game…
Alright then. I’ll take your word for it and try this right now. I’ll let you know if it works lol
Worked for me:
print(getUserOnlineStatus(game.Players:GetUserIdFromNameAsync("Thunder_Alex12")).lastOnlineTimestamps[1].lastOnline)
Okay, I’m just an idiot. I did this method before, but I didn’t pass the player userId as a parameter, I added into the url lol
Do you know of a way I can convert this to epoch time?
I think this works:
print(os.time({
year = date.Year, month = date.Month, day = date.Day, hour = date.Hour, min = date.Minute, sec = date.Second
})
First, convert the ISO date to Universal Time
local date = DateTime.fromIsoDate(isodate):ToUniversalTime()
iso date being the string or os.time()?
ISO Date being the last online date string.
So this returns epoch time after I convert it? cause ik os.time() returns epoch
The DateTime returns a formatted date… and then you convert it using the os.time() function
print(os.time({
year = date.Year, month = date.Month, day = date.Day, hour = date.Hour, min = date.Minute, sec = date.Second
})
Got it, thank you very much for your time. First time doing any of this, so I appreciate it.
You’re welcome, let me know if you have any more questions.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.