I decided to create this for my friends game and it took around 3 minutes to make as I didn’t know how to use the Social Service. This is really easy to make but I thought I would open source it for new games that don’t have as good scripters.
This is very customizable and is scripted for a user-interface system.
Features:
Shows how many friends are online.
Live updating friends online count.
Pops up invite so you can get friends to join when they click the button.
-----| CONFIGURATION |-----
local IniviteFriendsOnJoin = true -- Replace false with true if you want it to prompt invites to friends when they join the game.
local LocalPlayer = game:GetService("Players").LocalPlayer
local SocialService = game:GetService("SocialService")
local Friends = LocalPlayer:GetFriendsOnline()
repeat wait() until script.Parent.Parent:FindFirstChild("FriendsBackground")
repeat wait() until script.Parent.Parent.FriendsBackground:FindFirstChild("Button")
script.Parent.Parent.FriendsBackground.Button.MouseButton1Click:Connect(function()
SocialService:PromptGameInvite(LocalPlayer)
SocialService.GameInvitePromptClosed:Connect(function()
-- Coming Soon
end)
end)
if IniviteFriendsOnJoin == true then
SocialService:PromptGameInvite(LocalPlayer)
SocialService.GameInvitePromptClosed:Connect(function()
-- Coming Soon
end)
end
while wait() do
local FriendOnline = 0
for Number,Friend in pairs(Friends) do
FriendOnline = FriendOnline + 1
end
if FriendOnline == 0 then
FriendOnline = "NONE"
end
local FreindsFrame = script.Parent.Parent:FindFirstChild("FreindsFrame")
local FriendsText = FreindsFrame:FindFirstChild("Text")
if FreindsFrame and FriendsText then
FriendsText.Text = "FRIENDS ONLINE: "..FriendOnline
end
end
Unfortunately this is not substantial enough for this category, is incomplete, and uses some poor coding practices. Only submit finished and polished resources.