Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How should I detected if a player is online or offline?

Asked by
chaust 2
8 years ago

How would I check if a player is online. Like so like if ROBLOX was online a script that would be called would check if he is online or offline. I am thinking of a roblox api that does this, but I cannot find any. Help?

2 answers

Log in to vote
0
Answered by 8 years ago

I found the exact same question from a post 2 years ago. Hope this helps!

0
post didn't work updated answer chaust 2 — 7y
Ad
Log in to vote
0
Answered by
chaust 2
7 years ago

I have solved this myself here is the code:

function getOnlineStatus(username)
    local proxy = "https://www.rprxy.xyz"
    local id = game.Players:GetUserIdFromNameAsync(username)
    local httpService = game:GetService("HttpService")
    local user = httpService:GetAsync(proxy .. "/users/" .. id .. "/profile", true)
    return (string.find(user, "icon%-game") ~= nil) or (string.find(user, "icon%-online") ~= nil) or (string.find(user, "icon%-studio") ~= nil)
end

returns true if the user is online return false if they are offline

Answer this question