How to send in game friend requests

I know of FriendService, but it doesn’t state anywhere on the HUB how to send friend requests. I’ve seen multiple games that allow you to add friends from a custom made UI

1 Like

Refer to this page on the hub

https://developer.roblox.com/api-reference/function/StarterGui/SetCore

Specifically, PromptSendFriendRequest

2 Likes

PromptSendFriendRequest is an argument to SetCore, not a method:

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

local function retryCall(f, ...)
    while not pcall(f, ...) do
        RunService.Heartbeat:Wait()
    end
end

retryCall(function()
    StarterGui:SetCore("PromptSendFriendRequest", player)
end)

Do this from the client. We’re using a protected call because SetCores will throw if their associated core script hasn’t yet loaded.

19 Likes