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

Can I check if a player is online if they aren't in-game?

Asked by
Validark 1580 Snack Break Moderation Voter
10 years ago

I would like to have a gui in a place that can tell you which members of my group are online. I haven't been able to find any services to use yet so I can't work on the rest of the script.

Is there any way to check if a user is online on roblox? Some sort of function or service?

1
As far as I'm aware this is impossible without HTTP services, which I know nothing about. SquirreIOnToast 309 — 10y

2 answers

Log in to vote
1
Answered by 10 years ago

You have to use HTTPService, so make sure HttpEnabled for the HttpService is enabled, then you can use this code as a script in ServerScriptStorage to print the online status of player's IDs that you chat when you say "status/" then the ID.

local http = game:GetService("HttpService")

game.Players.PlayerAdded:connect(function(plr)
    plr.Chatted:connect(function(msg)
        if msg:lower():sub(1,7) == "status/" then
            local id = tonumber(msg:sub(8)) --Get the ID after the "/" in "status/"
            if id ~= nil then --If the ID doesn't return nil after being converted to a number then continue.
                local status = http:GetAsync("http://apiroblox.netne.net/GetUserStatus.php?id="..id) --Get online status of the player from the ID.
                local m = Instance.new("Message", game.Workspace)
                m.Text = "Status of player ID "..id..": "..tostring(status)
                wait(3)
                m:Destroy()
            end
        end
    end)
end) 

NOTE: This will print the entire status of the player, so if they're online, it tells you what the player is doing, same as how it appears on people's profiles.

Ad
Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
10 years ago

HTTP Service. This would require you to make your own website that reflected off of the information on roblox because of the rules of using HTTP Service - cannot perform on the Roblox website.

Answer this question