I have a script for TopBarPlus that displays the “Invite Friends” Menu using SocialService.
The script works fine. The issue is that the output is spamming with these errors:
Can someone tell me what I’m doing wrong?
Here’s the script:
local Icon = require(game:GetService("ReplicatedStorage").Icon)
local SocialService = game:GetService("SocialService")
local Player = game.Players.LocalPlayer
local icon = Icon.new()
:setLabel("Invite Friends", "deselected")
:setLabel("Open", "selected")
:setCaption("Invite your friends to join!")
local function onButtonPressed()
local success, result = pcall(
function()
return SocialService:CanSendGameInviteAsync(Player)
end
)
if result == true then
SocialService:PromptGameInvite(Player)
end
end
icon.selected:Connect(function()
onButtonPressed()
icon:deselect()
end)
I get the same result when I use this with a button instead of TopBarPlus as well.