How can I get a script to tell me if a player is online?

Hi, everyone.
How can I make a function that returns a true/false regarding whether a player is online or not?
Something like IsOnline(UserId)


I think this isnt best way, but you can use api and get 1st players friend name and then find the player in list of friends of the player, that is friend of player, you want

1 Like

I actually tried this before. But obviously it breaks if they have no friends.

1 Like

You can use FriendService to determine when a friend goes online. I’m pretty sure you can’t determine when another player (that isn’t your friend) is online.


This is all I can help you with. When I figure out how to use this in a second, I will write you a short script to help you. Have a nice day!


Couldn’t we use the same request that the website uses when you load a players profile?

Roblox is very unfriendly for getting info about some player, that isnt someones friend, or isnt in any group. But it will be good idea to write feature request

I think NO, or its extremly hard, because you must read it from HTML.
When you use normal API, the response from getting friend of someone is:

    "Id": 12345678,
    "Username": "user",
    "AvatarUri": "",
    "AvatarFinal": true,
    "IsOnline": true

, but from gettin info from player id is

    "Id": 12345678,
    "Username": "user name"

Wait, i tried to do it in browser and it returned this:


(url i use:{ID})

When I try this, whether they are actually online or not, it always returns false. Same happen for you?

Yes, it returned null or false everything except id and name, I think, that this is bug or uncomplited feature. But as I saied:

or bug report

1 Like

Hello I think you will have to call this API:
Change USERID with player ID of course.
You might try it out. I hope this helps. :herb: