SharedSignalEvent
SharedEvents are built on the same backend networking as regular events. However, they do not require an explicit :Server
or :Client
call to use.
Unlike SharedEvents, SharedSignalEvents may have any number of listeners set.
OnServer Server
Adds a server callback, returning a disconnect function.
<T...>(
Listener: (Player: Player, T...) -> () -- The listener to register
) -> (() -> ()) -- Disconnect function
<T...>(
Listener: (Player: Player, T...) -> () -- The listener to register
) -> (() -> ()) -- Disconnect function
This method adds a server callback, returning a disconnect function. Errors if called from the client.
MyEvent:OnServer(function(Player, Argument)
print(Player, Argument)
end)
MyEvent:OnServer(function(Player, Argument)
print(Player, Argument)
end)
OnClient Client
Adds a client callback, returning a disconnect function.
<T...>(
Listener: (T...) -> () -- The listener to register
) -> (() -> ()) -- Disconnect function
<T...>(
Listener: (T...) -> () -- The listener to register
) -> (() -> ()) -- Disconnect function
This method adds a client callback, returning a disconnect function. Errors if called from the server.
MyEvent:OnClient(function(Argument)
print(Argument)
end)
MyEvent:OnClient(function(Argument)
print(Argument)
end)
FireServer Client
Fires the event to the server.
<T...>(
...: T... -- The event payload
) -> ()
<T...>(
...: T... -- The event payload
) -> ()
This method fires the event to the server. Errors if called from the server.
MyEvent:FireServer("Hello, World!")
MyEvent:FireServer("Hello, World!")
FireClient Server
Fires the event to a specific player.
<T...>(
Player: Player, -- The target player
...: T... -- The event payload
) -> ()
<T...>(
Player: Player, -- The target player
...: T... -- The event payload
) -> ()
This method fires the event to a specific client. Errors if called from the client.
MyEvent:FireClient(player, "Hello, World!")
MyEvent:FireClient(player, "Hello, World!")
FireAllClients Server
Fires the event to all players.
<T...>(
...: T... -- The event payload
) -> ()
<T...>(
...: T... -- The event payload
) -> ()
This method fires the event to all players. Errors if called from the client.
MyEvent:FireAllClients("Hello, World!")
MyEvent:FireAllClients("Hello, World!")
FireAllClientsExcept Server
Fires the event to every player except one.
<T...>(
Player: Player, -- Player to be ignored
...: T... -- The event payload
)
<T...>(
Player: Player, -- Player to be ignored
...: T... -- The event payload
)
This method fires the event to every player except one. Errors if called from the client.
MyEvent:FireAllClientsExcept(player, "Hello, World!")
MyEvent:FireAllClientsExcept(player, "Hello, World!")
FireClients Server
Fires the event to every player in the given list.
<T...>(
Players: { Player }, -- List of players to fire the event to
...: T... -- The event payload
) -> ()
<T...>(
Players: { Player }, -- List of players to fire the event to
...: T... -- The event payload
) -> ()
This method fires the event to every player in the list. Errors if called from the client.
MyServer:FireClients({ player }, "Hello, World!")
MyServer:FireClients({ player }, "Hello, World!")
FireFilteredClients Server
Fires the event to every player that passes the given filter function.
<T...>(
Filter: (Player) -> boolean -- Must return true for a player to receive the event.
...: T... -- The event payload
) -> ()
<T...>(
Filter: (Player) -> boolean -- Must return true for a player to receive the event.
...: T... -- The event payload
) -> ()
This method fires the event to every player that passes the filter. Errors if called from the client.
MyServer:FireFilteredClients(function(player)
return player.Name == "Player1"
end, "Hello, World!")
MyServer:FireFilteredClients(function(player)
return player.Name == "Player1"
end, "Hello, World!")