Reproduction code:
spawn(function()
local onlinefriends = {}
local randomfriend = nil
local CallBackBind = Instance.new("BindableFunction")
CallBackBind.OnInvoke = function(object)
-- Invite random friend if yes
if object == "Yes" then
game:GetService("SocialService"):PromptGameInvite(game.Players.LocalPlayer)
end
return
end
while wait(math.random(10,12)) do
local onlinefriends = {}
local success,friends = pcall(function()
return game.Players.LocalPlayer:GetFriendsOnline()
end)
if not success then
warn(friends)
continue
end
for i,v in friends do
table.insert(onlinefriends,v["VisitorId"])
end
local randomfriend = onlinefriends[math.random(1,#onlinefriends)]
local success,name = pcall(function()
return game.Players:GetNameFromUserIdAsync(randomfriend)
end)
local sucess,icon = pcall(function()
return game.Players:GetUserThumbnailAsync(randomfriend,Enum.ThumbnailType.HeadShot,Enum.ThumbnailSize.Size420x420)
end)
if not success then
continue
end
if not sucess then
icon = ""
end
game.StarterGui:SetCore("SendNotification", {
Title = "Friend Online!";
Text = "Would you like to invite "..name.."?";
Icon = icon;
Callback = CallBackBind;
Button1 = "Accept";
Button2 = "Decline";
Duration = 5;
})
onlinefriends = {}
friends = {}
randomfriend = nil
end
end)
Note the following script doesn’t return any errors which means its probably yeld in the core side:
Update:
Pormpt invite is currently down on our experience.
System Information:
Windows 11 Pro 24H2