Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local SocialService = game:GetService("SocialService")
- local Players = game:GetService("Players")
- local player = Players.LocalPlayer
- local function canSendGameInvite(targetPlayer)
- local res, canSend = pcall(SocialService:CanSendGameInvite(targetPlayer))
- return res and canSend
- end
- local function promptGameInvite(targetPlayer)
- local res, canInvite = pcall(SocialService:PromptGameInvite(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
- end
- local function inputBegan(input, gameProcessed)
- local inputType = input.UserInputType
- local touch = Enum.UserInputType.Touch
- local mouse1 = Enum.UserInputType.MouseButton1
- if inputType == touch or inputType == mouse1 then
- openGameInvitePrompt(player)
- end
- end
- script.Parent.InputBegan:Connect(inputBegan)
- SocialService.GameInvitePromptClosed:Connect(invitePromptClosed)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement