Signals
A Signal, created with Owl.CreateSignal(options), is a one-off event no stored state, just "this happened, here's the data that came with it." The right tool for visual effects, notifications, sounds, anything that doesn't need to be readable after the fact. For persistent state instead, see Properties.
Options
Owl.CreateSignal({
unreliable = false, -- > // true = UnreliableRemoteEvent (less reliable, cheaper)
inbound = {}, -- > // Middleware specific to this Signal
outbound = {},
})unreliable = true swaps the underlying RemoteEvent for an UnreliableRemoteEvent fine for high-frequency, non-critical data (a per-frame position update, for instance) where an occasionally dropped packet doesn't matter and isn't worth the reliability overhead. Leave it false for anything that must arrive (a notification, a state-changing event).
Server side
| Method | Description |
|---|---|
:Fire(plr, ...) |
Sends to one specific player |
:FireAll(...) |
Sends to every player |
:FireFilter(fn, ...) |
Sends to every player matching a condition |
:FireExcept(plr, ...) |
Sends to everyone except one player |
-- > // Notify one player
self.Client.NotificationReceived:Fire(player, "Welcome!")
-- > // Notify everyone
self.Client.WorldEventStarted:FireAll("Meteor shower")
-- > // Notify one team
self.Client.TeamAlert:FireFilter(function(plr)
return plr.Team == Teams.Blue
end, "Incoming attack!")Client side
self.EffectService.ExplosionOccured:Connect(function(position)
playExplosionEffect(position)
end):Connect(fn) only fires for events that happen after the connection is made unlike a Property's :Observe, there's no "current value" to replay, since a Signal doesn't hold any state to begin with. That's the entire distinction between the two: reach for a Property when the client might need the value at an arbitrary point in time aand a Signal when you only care about the moment something happens.
Where to go next
- Properties - persistent state, for anything the client needs to read at any time.
- Client Methods - for the client to request something from the server on demand, the third and last communication abstraction.
- Middleware - how the
inbound/outboundoptions above actually get used.