'OnFriendOnline' notification

Hey there!

I remember seeing some kind of notification whenever your friend went online on a roblox’s website inside of some game (which I don’t remember), and I wonder how it was created.
And so, I wanted to recreate that because it seems interesting.

My question has arise:
Is there anything like OnFriendOnline event somewhere?

I would need it to notify the user about that friend being online right now
I couldn’t find any information about that anywhere, so I assume that it just doesn’t exist…

I started writing my first lines of code while looking at some tutorials.

My first idea was to make a while loop which would compare two tables (Friends, FriendsCurrent) and check if they’re different (aiming for IsOnline difference).
I used GetFriendsAsync for that.

However, that didn’t work because this service has some request limits and so it wasn’t quick and efficient at all as I expected it to be…

Now, how could I solve these problems?
Does anyone know or have an idea about how this notification was coded?



I believe it is


Source: Player:GetFriendsOnline()

I’ve been reading about it, but I believe it’s not what I am searching for.
However, I might try and replace that with the method I used for GetFriendsAsync.

I’ll reach out to you one more time when I am done.

You can check the players online friends every so often and see if its changed.

Heres a rough draft of how I would do it

function GetOnlineFriends()
     local Player = game.Players.localPlayer
     return Player:GetfriendsOnline()
local F1 = {}
local F2 = {}
local TempList = {}
while true do
     if F2[1] == nil then
          F2 = GetOnlinePlayers()
     wait(10) -- Enter time between checks
     F1 = GetOnlineFriends()
     local TempList = GetOnlineFriends()
     for i = 1,#F1 do
          for i2 = 1,#F2 do
               if F1[i] == F2[i2] then
                    Templist[i] = nil
                    if table.find(F1,F2[i2]) == nil then
                         -- Player is no longer online
     for i = 1,#TempList do
          --- Notify New Player Online
          TempList[i] = nil -- Clears List
     TempList = {}
     F2 = GetOnlinePlayers()

I feel an explanation is required.
It takes a list of players that are online, it will then compare that to the last check. The templist is basically a list that has all the players, the players are removed from the list during this check so should players be left over they have just joined. Any players that arent in the check after appearing in the previous check will have left the game.


I am pretty sure the notification that you are talking about is this:

Just do the other friends stuff

local Players = game:GetService("Players")
local StarterGui = game:GetService("StarterGui")

local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size60x60
local content, isReady = Players:GetUserThumbnailAsync(VisitorId, thumbType, thumbSize)

StarterGui:SetCore("SendNotification", {
	Title = "Friend Join a game",
	Text = "Your friend  .. UserName .. "...",
	Icon = content,
	Duration = 5,

Yes, I was also trying to search for it but I completely forgot what name did it have.
I remember using it in past though.


I was actually going to do that function just when @matiss112233 showed me GetFriendsOnline() function.

I quickly noticed that it doesn’t have any request limits (cause it’s not an API I think).

It will help me by a lot though, I was hardly thinking on how would I create a function like this.

Also, I don’t think that you have to put 10 seconds as a wait time here.
I might be wrong, but it seems like it’s a bit too much.
I think that atleast 0.15 would be perfect for this function, since it only returns an array (table)…


1 Like

This is an API, and you will hit rate limits quickly.

I’ve managed to send around 500 successful returns in like 5 seconds while testing.
Are you sure?

1 Like

GetFriendsOnline has no rate limits - or if it does I wasn’t able to find any documentation or reference to it whatsoever. I believe your thinking about flat out Http requests which do have a direct limit per API key.