Informacje o wersji
Edukacja
Klasa silnika
PluginConnectionService
Brak możliwości tworzenia
Usługa
Bez replikacji

*Ta zawartość została przetłumaczona przy użyciu narzędzi AI (w wersji beta) i może zawierać błędy. Aby wyświetlić tę stronę w języku angielskim, kliknij tutaj.


Podsumowanie
Członkowie odziedziczeni
Przykłady kodu
PluginConnection echo Plugin
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 "Serwer" else "Klient")
Connection:SendMessage("Witaj Edytor!")
end

Materiały referencyjne dotyczące interfejsów API
Metody
CanHaveConnectionType
Zabezpieczenia dodatku plug-in
PluginConnectionService:CanHaveConnectionType(type:Enum.PluginConnectionTargetType):boolean
Zwroty

GetPluginConnectionsOfType
Zabezpieczenia dodatku plug-in
PluginConnectionService:GetPluginConnectionsOfType(type:Enum.PluginConnectionTargetType):{PluginConnection}

Zdarzenia
Connected
Zabezpieczenia dodatku plug-in
PluginConnectionService.Connected(conn:PluginConnection):RBXScriptSignal
Parametry

©2026 Roblox Corporation. Nazwa Roblox, logo Roblox oraz hasło „Powering Imagination” należą do naszych zarejestrowanych i niezarejestrowanych znaków towarowych na terenie Stanów Zjednoczonych oraz w innych krajach.