Social Service invite friend button isn't sending invites

I got my code from roblox docs and it only displays the actual gui where you invite people. The problem is it doesn’t invite people on roblox and send them game link.

I looked online for solutions none worked.

-- This is an example Lua code block
local SocialService = game:GetService("SocialService")
local Players = game:GetService("Players")

local player = Players.LocalPlayer

-- Function to check whether the player can send an invite
local function canSendGameInvite(sendingPlayer)
	local success, canSend = pcall(function()
		return SocialService:CanSendGameInviteAsync(sendingPlayer)
	end)
	return success and canSend
end

local canInvite = canSendGameInvite(player)
if canInvite then
	local success, errorMessage = pcall(function()
		SocialService:PromptGameInvite(player)
	end)
end

How can i get it to actually send the invite prompt to the player being invited? I thought this code would work from roblox’s docs.

Are you testing in studio or in game?

I am testing on roblox website in a game server.

This can only be done if someone presses the “Invite” button on the prompt.

I testing it out though, I clicked on the invite button and it didn’t send a request to my friend on roblox.

When i say invite button i mean the invite button on the prompt