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

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


코드 샘플
PluginConnection 에코 플러그인
local Service = game:GetService("PluginConnectionService")
local TestType = Enum.PluginConnectionTargetType.Test
local EditType = Enum.PluginConnectionTargetType.Edit
local function MakeConnection(Connection: PluginConnection, Side: string)
assert(Connection.Connected)
local Count = 0
local Binding = Connection:BindToMessage(function(Msg: string)
print(Msg)
task.wait(1)
if Connection.Connected then
Connection:SendMessage(`Hello from {Side} iteration {Count}`)
end
Count += 1
end)
plugin.Unloading:Connect(function()
Binding:Disconnect()
end)
Connection:GetPropertyChangedSignal("Connected"):Once(function()
assert(not Connection.Connected)
print("Disconnected", Connection.TargetId)
end)
end
if Service:CanHaveConnectionType(TestType) then
for _, ExistingConnection in Service:GetPluginConnectionsOfType(TestType) do
MakeConnection(ExistingConnection, "Edit")
end
Service.Connected:Connect(function(NewConnection)
if NewConnection.Type == TestType then
MakeConnection(NewConnection, "Edit")
end
end)
elseif Service:CanHaveConnectionType(EditType) then
local Connections = Service:GetPluginConnectionsOfType(EditType)
assert(#Connections <= 1)
local Connection: PluginConnection? = nil
if #Connections == 1 then
Connection = Connections[1]
else
while true do
local NewConnection = Service.Connected:Wait()
if NewConnection.Type == EditType then
Connection = NewConnection
break
end
end
end
assert(Connection)
assert(Connection.Connected)
MakeConnection(Connection, if game:GetService("RunService"):IsServer() then "Server" else "Client")
Connection:SendMessage("안녕하세요, 편집입니다!")
end

API 참조
메서드
CanHaveConnectionType
플러그인 보안
PluginConnectionService:CanHaveConnectionType(type:Enum.PluginConnectionTargetType):boolean
반환

GetPluginConnectionsOfType
플러그인 보안
PluginConnectionService:GetPluginConnectionsOfType(type:Enum.PluginConnectionTargetType):{PluginConnection}

이벤트
Connected
플러그인 보안
PluginConnectionService.Connected(conn:PluginConnection):RBXScriptSignal
매개 변수

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