#Invite players reward

1 messages · Page 1 of 1 (latest)

neon heath
#

I made a button that if you press it shows the invite thing but I wanted to to that when a player you invited join you get currency but idk or if it’s even possible

distant nacelle
# neon heath I made a button that if you press it shows the invite thing but I wanted to to t...
local HttpService = game:GetService("HttpService")
local SocialService = game:GetService("SocialService")
local Players = game:GetService("Players")

local player = Players.LocalPlayer

local data = {
    senderUserID = player.UserId,
    spawnLocation = {12, 48, 205.5}
}

local launchData = HttpService:JSONEncode(data)

-- Construct invite options with launch data
local inviteOptions = Instance.new("ExperienceInviteOptions")
inviteOptions.LaunchData = launchData

-- 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
    SocialService:PromptGameInvite(player, inviteOptions)
end
#

scroll down a bit

neon heath
#

Bro I know how invite script works but I want that when a invited player joins you get rewarded with currency

neon heath
#

Alr