배우기
엔진 클래스
SocialService
만들 수 없음
서비스
복제되지 않음

*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.



API 참조
메서드
CanSendCallInviteAsync
생성
기능: Social
SocialService:CanSendCallInviteAsync(player:Instance):boolean
매개 변수
player:Instance
반환
코드 샘플
소셜 서비스:PromptPhoneBook()
local Players = game:GetService("Players")
local SocialService = game:GetService("SocialService")
local player = Players.LocalPlayer
local button = script.Parent
button.Visible = false
-- 플레이어가 통화 초대를 보낼 수 있는지 확인하는 함수
local function canSendCallingInvite(sendingPlayer)
local success, canSend = pcall(function()
return SocialService:CanSendCallInviteAsync(sendingPlayer)
end)
return success and canSend
end
local canCall = canSendCallingInvite(player)
if canCall then
button.Visible = true
button.Activated:Connect(function()
SocialService:PromptPhoneBook(player, "")
end)
end

CanSendGameInviteAsync
생성
기능: Social
SocialService:CanSendGameInviteAsync(
player:Instance, recipientId:User
매개 변수
player:Instance
recipientId:User
기본값: "U1.AQAAAAAAAAAAAAAAAAAAAAA"
반환
코드 샘플
초대 보내기
local SocialService = game:GetService("SocialService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
-- 플레이어가 초대를 보낼 수 있는지 확인하는 함수
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)
end

GetEventRsvpStatusAsync
생성
기능: Social
SocialService:GetEventRsvpStatusAsync(eventId:string):Enum.RsvpStatus
매개 변수
eventId:string
코드 샘플
소셜 서비스: 이벤트에 RSVP 요청 비동기()
local SocialService = game:GetService("SocialService")
local EVENT_ID = "YOUR_EVENT_ID"
local followPrompt: ProximityPrompt = script.Parent.FollowProximityPrompt
local unFollowPrompt: ProximityPrompt = script.Parent.UnfollowProximityPrompt
local function updatePrompt(rsvpStatus: Enum.RsvpStatus)
if rsvpStatus == Enum.RsvpStatus.Going then
unFollowPrompt.Enabled = true
followPrompt.Enabled = false
else
unFollowPrompt.Enabled = false
followPrompt.Enabled = true
end
end
local success, currentRsvpStatus = pcall(function()
return SocialService:GetEventRsvpStatusAsync(EVENT_ID)
end)
if not success then
-- RSVP 상태를 가져올 수 없습니다; 둘 중 어떤 근접 프롬프트도 활성화하지 마세요
warn("RSVP 상태를 가져오는데 실패했습니다:", currentRsvpStatus)
return
end
print("현재 RSVP 상태:", currentRsvpStatus)
updatePrompt(currentRsvpStatus)
unFollowPrompt.Triggered:Connect(function(player)
local rsvpStatus = SocialService:PromptRsvpToEventAsync(EVENT_ID)
updatePrompt(rsvpStatus)
end)
followPrompt.Triggered:Connect(function(player)
local rsvpStatus = SocialService:PromptRsvpToEventAsync(EVENT_ID)
updatePrompt(rsvpStatus)
end)

GetExperienceEventAsync
생성
기능: Social
SocialService:GetExperienceEventAsync(eventId:string):ExperienceEvent?
매개 변수
eventId:string
반환
ExperienceEvent?
코드 샘플
소셜서비스:향후경험이벤트가져오기비동기()
local SocialService = game:GetService("SocialService")
-- 다음 진행 중인/예정된 이벤트를 발견하고 플레이어에게 RSVP를 요청합니다
local function promptNextUpcomingEvent()
local success, eventsOrError = pcall(function()
return SocialService:GetUpcomingExperienceEventsAsync()
end)
if not success then
warn("예정된 이벤트를 로드하는 데 실패했습니다:", eventsOrError)
return
end
local upcomingEvents = eventsOrError
local selectedEvent
for _, event in ipairs(upcomingEvents) do
if not event.HasStarted and not event.HasEnded then
selectedEvent = event
break
end
end
if selectedEvent then
local success, result = pcall(function()
return SocialService:PromptRsvpToEventAsync(selectedEvent.Id)
end)
if not success then
warn("RSVP 요청 실패:", result)
end
else
warn("요청할 미래 이벤트가 없습니다.")
return
end
end
promptNextUpcomingEvent()

GetPartyAsync
생성
기능: Social
SocialService:GetPartyAsync(partyId:string):{any}
매개 변수
partyId:string
반환
코드 샘플
소셜서비스:GetPartyAsync()
local SocialService = game:GetService("SocialService")
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local partyId = player.PartyId
if partyId == "" then
warn("플레이어가 파티에 없습니다")
return
end
local success, partyData = pcall(function()
return SocialService:GetPartyAsync(partyId)
end)
if success and partyData then
for _, partyMemberData in partyData do
print(
partyMemberData.UserId,
partyMemberData.PlaceId,
partyMemberData.JobId,
partyMemberData.PrivateServerId,
partyMemberData.ReservedServerAccessCode
)
end
else
warn("파티 데이터 검색 실패")
end
end)

GetPlayersByPartyId
기능: Social
SocialService:GetPlayersByPartyId(partyId:string):{Player}
매개 변수
partyId:string
반환
코드 샘플
소셜서비스:파티ID로플레이어가져오기()
local SocialService = game:GetService("SocialService")
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local partyId = player.PartyId
if partyId ~= "" then
local partyPlayers: { Player } = SocialService:GetPlayersByPartyId(partyId)
for _, partyMember in partyPlayers do
print("파티원: " .. partyMember.Name)
end
else
warn("플레이어는 파티에 있지 않습니다")
end
end)
파티 통합이 포함된 팀 재조정
local Teams = game:GetService("Teams")
local Players = game:GetService("Players")
local SocialService = game:GetService("SocialService")
local redTeam = Instance.new("Team")
redTeam.Name = "레드 팀"
redTeam.TeamColor = BrickColor.Red()
redTeam.AutoAssignable = false
redTeam.Parent = Teams
local blueTeam = Instance.new("Team")
blueTeam.Name = "블루 팀"
blueTeam.TeamColor = BrickColor.Blue()
blueTeam.AutoAssignable = false
blueTeam.Parent = Teams
local function assignPlayerToTeam(player)
local partyId = player.PartyId
if partyId == "" then
assignBalancedTeam(player)
return
end
local teams = { redTeam, blueTeam }
local matchingTeam = nil
local partyPlayers = SocialService:GetPlayersByPartyId(partyId)
for _, partyPlayer in partyPlayers do
if partyPlayer ~= player and table.find(teams, partyPlayer.Team) then
matchingTeam = partyPlayer.Team
break
end
end
if matchingTeam then
player.Team = matchingTeam
player.TeamColor = matchingTeam.TeamColor
else
assignBalancedTeam(player)
end
end
function assignBalancedTeam(player)
local redCount = #redTeam:GetPlayers()
local blueCount = #blueTeam:GetPlayers()
local chosenTeam = redCount <= blueCount and redTeam or blueTeam
player.Team = chosenTeam
player.TeamColor = chosenTeam.TeamColor
end
local function groupPlayersByParty()
local seenPartyIds = {}
local groupedPlayers = {}
for _, player in Players:GetPlayers() do
if player.PartyId == "" then
table.insert(groupedPlayers, { player })
elseif not table.find(seenPartyIds, player.PartyId) then
table.insert(seenPartyIds, player.PartyId)
local partyPlayers = SocialService:GetPlayersByPartyId(player.PartyId)
table.insert(groupedPlayers, partyPlayers)
end
end
return groupedPlayers
end
-- 이 함수를 호출하여 팀의 균형을 재조정합니다
local function rebalanceTeams()
local groups = groupPlayersByParty()
table.sort(groups, function(a, b)
return #a > #b
end)
for _, player in Players:GetPlayers() do
player.Team = nil
end
for _, group in groups do
local redCount = #redTeam:GetPlayers()
local blueCount = #blueTeam:GetPlayers()
local bestTeam
if redCount <= blueCount then
bestTeam = redTeam
else
bestTeam = blueTeam
end
for _, player in group do
player.Team = bestTeam
player.TeamColor = bestTeam.TeamColor
end
end
for _, player in Players:GetPlayers() do
player:LoadCharacterAsync()
end
end
Players.PlayerAdded:Connect(function(player)
assignPlayerToTeam(player)
player:LoadCharacterAsync()
player:GetPropertyChangedSignal("PartyId"):Connect(function()
if player.PartyId ~= "" then
assignPlayerToTeam(player)
end
end)
end)

GetUpcomingExperienceEventsAsync
생성
기능: Social
SocialService:GetUpcomingExperienceEventsAsync():{ExperienceEvent}
반환
{ExperienceEvent}
코드 샘플
소셜서비스:향후경험이벤트가져오기비동기()
local SocialService = game:GetService("SocialService")
-- 다음 진행 중인/예정된 이벤트를 발견하고 플레이어에게 RSVP를 요청합니다
local function promptNextUpcomingEvent()
local success, eventsOrError = pcall(function()
return SocialService:GetUpcomingExperienceEventsAsync()
end)
if not success then
warn("예정된 이벤트를 로드하는 데 실패했습니다:", eventsOrError)
return
end
local upcomingEvents = eventsOrError
local selectedEvent
for _, event in ipairs(upcomingEvents) do
if not event.HasStarted and not event.HasEnded then
selectedEvent = event
break
end
end
if selectedEvent then
local success, result = pcall(function()
return SocialService:PromptRsvpToEventAsync(selectedEvent.Id)
end)
if not success then
warn("RSVP 요청 실패:", result)
end
else
warn("요청할 미래 이벤트가 없습니다.")
return
end
end
promptNextUpcomingEvent()

HideSelfView
기능: Social
SocialService:HideSelfView():()
반환
()

PromptFeedbackSubmissionAsync
생성
기능: Social
SocialService:PromptFeedbackSubmissionAsync(options:Dictionary?):()
매개 변수
options:Dictionary?
반환
()
코드 샘플
소셜서비스:피드백제출요청비동기()
local SocialService = game:GetService("SocialService")
-- 피드백 요청 함수
local function promptForFeedback()
local success, errorMessage = pcall(function()
SocialService:PromptFeedbackSubmissionAsync()
end)
if success then
print("피드백 요청이 완료되었습니다")
else
warn("피드백 요청에 실패했습니다:", errorMessage)
end
end
-- 플레이어가 이정표에 도달했을 때 피드백 요청
local function onMilestoneReached()
promptForFeedback()
end
-- 예제 사용: 게임 이벤트에 연결
game.ReplicatedStorage.MilestoneReached.OnClientEvent:Connect(onMilestoneReached)
소셜 서비스:PromptFeedbackSubmissionAsync() — 플레이어 지원
local SocialService = game:GetService("SocialService")
local function promptPlayerSupport()
local success, errorMessage = pcall(function()
SocialService:PromptFeedbackSubmissionAsync({
FeedbackType = Enum.FeedbackType.PlayerSupport,
})
end)
if success then
print("플레이어 지원 프롬프트가 완료되었습니다.")
else
warn("플레이어 지원 프롬프트에 실패했습니다:", errorMessage)
end
end
-- 사용 예: ScreenGui의 도움 버튼에 연결
local helpButton = script.Parent:WaitForChild("HelpButton")
helpButton.Activated:Connect(function()
task.spawn(promptPlayerSupport)
end)

PromptGameInvite
기능: Social
SocialService:PromptGameInvite(
player:Instance, experienceInviteOptions:Instance
):()
매개 변수
player:Instance
experienceInviteOptions:Instance
기본값: "nil"
반환
()
코드 샘플
초대 보내기
local SocialService = game:GetService("SocialService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
-- 플레이어가 초대를 보낼 수 있는지 확인하는 함수
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)
end

PromptLinkSharing
사용되지 않음

PromptLinkSharingAsync
생성
기능: Social
SocialService:PromptLinkSharingAsync(
player:Player, options:Dictionary
매개 변수
player:Player
options:Dictionary
기본값: "nil"
반환

PromptPhoneBook
기능: Social
SocialService:PromptPhoneBook(
player:Instance, tag:string
):()
매개 변수
player:Instance
tag:string
반환
()
코드 샘플
소셜 서비스:PromptPhoneBook()
local Players = game:GetService("Players")
local SocialService = game:GetService("SocialService")
local player = Players.LocalPlayer
local button = script.Parent
button.Visible = false
-- 플레이어가 통화 초대를 보낼 수 있는지 확인하는 함수
local function canSendCallingInvite(sendingPlayer)
local success, canSend = pcall(function()
return SocialService:CanSendCallInviteAsync(sendingPlayer)
end)
return success and canSend
end
local canCall = canSendCallingInvite(player)
if canCall then
button.Visible = true
button.Activated:Connect(function()
SocialService:PromptPhoneBook(player, "")
end)
end

PromptRsvpToEventAsync
생성
기능: Social
SocialService:PromptRsvpToEventAsync(eventId:string):Enum.RsvpStatus
매개 변수
eventId:string
코드 샘플
소셜 서비스: 이벤트에 RSVP 요청 비동기()
local SocialService = game:GetService("SocialService")
local EVENT_ID = "YOUR_EVENT_ID"
local followPrompt: ProximityPrompt = script.Parent.FollowProximityPrompt
local unFollowPrompt: ProximityPrompt = script.Parent.UnfollowProximityPrompt
local function updatePrompt(rsvpStatus: Enum.RsvpStatus)
if rsvpStatus == Enum.RsvpStatus.Going then
unFollowPrompt.Enabled = true
followPrompt.Enabled = false
else
unFollowPrompt.Enabled = false
followPrompt.Enabled = true
end
end
local success, currentRsvpStatus = pcall(function()
return SocialService:GetEventRsvpStatusAsync(EVENT_ID)
end)
if not success then
-- RSVP 상태를 가져올 수 없습니다; 둘 중 어떤 근접 프롬프트도 활성화하지 마세요
warn("RSVP 상태를 가져오는데 실패했습니다:", currentRsvpStatus)
return
end
print("현재 RSVP 상태:", currentRsvpStatus)
updatePrompt(currentRsvpStatus)
unFollowPrompt.Triggered:Connect(function(player)
local rsvpStatus = SocialService:PromptRsvpToEventAsync(EVENT_ID)
updatePrompt(rsvpStatus)
end)
followPrompt.Triggered:Connect(function(player)
local rsvpStatus = SocialService:PromptRsvpToEventAsync(EVENT_ID)
updatePrompt(rsvpStatus)
end)

ShowSelfView
기능: Social
SocialService:ShowSelfView(selfViewPosition:Enum.SelfViewPosition):()
매개 변수
selfViewPosition:Enum.SelfViewPosition
기본값: "LastPosition"
반환
()

이벤트
CallInviteStateChanged
기능: Social
SocialService.CallInviteStateChanged(
player:Instance, inviteState:Enum.InviteState
매개 변수
player:Instance
inviteState:Enum.InviteState
코드 샘플
소셜서비스.초대상태변경
local SocialService = game:GetService("SocialService")
local button = script.Parent
local isPhonebookOpen = false
SocialService.CallInviteStateChanged:Connect(function(_, inviteState)
local isCalling = inviteState == Enum.InviteState.Placed
-- 전화를 걸고 있거나 전화부가 열려있는 경우
if isCalling or isPhonebookOpen then
button.Visible = false
else
button.Visible = true
end
end)

GameInvitePromptClosed
기능: Social
SocialService.GameInvitePromptClosed(
player:Instance, recipientIds:{any}
매개 변수
player:Instance
recipientIds:{any}

PhoneBookPromptClosed
기능: Social
SocialService.PhoneBookPromptClosed(player:Instance):RBXScriptSignal
매개 변수
player:Instance

ShareSheetClosed
기능: Social
SocialService.ShareSheetClosed(player:Player):RBXScriptSignal
매개 변수
player:Player

콜백
OnCallInviteInvoked
기능: Social
SocialService.OnCallInviteInvoked(
tag:string, callParticipantIds:{any}
매개 변수
tag:string
callParticipantIds:{any}
반환
코드 샘플
소셜서비스.온콜초대호출됨
local SocialService = game:GetService("SocialService")
local TeleportService = game:GetService("TeleportService")
SocialService.OnCallInviteInvoked = function()
local placeId = 0123456789 -- 통화 참가자를 드롭할 장소의 ID입니다
local accessCode = TeleportService:ReserveServerAsync(placeId)
return { ReservedServerAccessCode = accessCode, PlaceId = placeId }
end

©2026 Roblox Corporation. Roblox 및 Roblox 로고, 'Powering Imagination'은 미국 및 기타 국가 내 당사의 등록 및 미등록 상표입니다.