Roblox how to create a invite promp on your game?

Hello everyone today ı want to do invite promp like these game

As ı said someone help me to the doing this etc:scripting

You can use the SocialService to make it.

1 Like

I’ve made a working invite friends gui but I’m trying to do a script that when you touch a part the invite gui will appear.

When you will finish it share with us haha! :happy3:

-- Local Script
local SocialService = game:GetService("SocialService")
local Players = game:GetService("Players")

local player = Players.LocalPlayer
local part = script.Parent

local function canSendGameInvite(targetPlayer)
	local res, canSend = pcall(SocialService.CanSendGameInvite, SocialService, targetPlayer)
	return res and canSend
end
 
local function promptGameInvite(targetPlayer)
	local res, canInvite = pcall(SocialService.PromptGameInvite, SocialService, targetPlayer)
	return res and canInvite
end
 
local function openGameInvitePrompt(targetPlayer)
	local canInvite = canSendGameInvite(targetPlayer)
	if canInvite then
		local promptOpened = promptGameInvite(targetPlayer)
		return promptOpened
	end
	return false
end
 
local function invitePromptClosed(senderPlayer, recipientIds)
	-- Handle custom logic for players invited by sender
	button.Visible = false
end
 
local function onActivated()
	openGameInvitePrompt(player)
end

part.Touched:Connect(function(plr)
    if plr == player then
        onActivated()
        SocialService.GameInvitePromptClosed:Connect(function(senderPlayer,ids)
            if senderPlayer == player then
                Players.PlayerAdded:Connect(function(friend)
                    for _,id in pairs(ids) do
                        if id == friend.UserId then
                            print("An invited friend joined the player.")
                            -- fire an event to the server to give the player a specific tool
                        end
                    end
                end)
            end
        end)
        local Ids = SocialService.GameInvitePromptClosed:Connect(invitePromptClosed)
    end
end)