What do you want to achieve?
Working Invite GUI sending a message
What is the issue?
Invite GUI doesnt work (doesnt send a message)
What solutions have you tried so far?
Trying to fix with tutorials
Code:
local SocialService = game:GetService("SocialService")
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function(click)
local success, result = pcall(
function()
return SocialService:CanSendGameInviteAsync(player)
end
)
if result == true then
SocialService:PromptGameInvite(player)
end
end)
local canSend = game:GetService("SocialService"):CanSendGameInviteAsync(game.Players.LocalPlayer)
if canSend then
script.Parent.MouseButton1Click:Connect(function()
game:GetService("SocialService"):PromptGameInvite(game.Players.LocalPlayer)
end)
end
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 function onClick()
local canInvite = canSendGameInvite(player)
if canInvite then
local success, errorMessage = pcall(function()
SocialService:PromptGameInvite(player)
end)
-- Warn in case it's failing
if errorMessage then
warn(errorMessage)
end
end
end
script.Parent.MouseButton1Click:Connect(onClick)