Skip to main content

Signal.Event ⚡

This is an event that can be attached to a signal on both the client and the server. It gets called whenever someone :fire's the signal associated to this signal.

Parameters:

NameTypeDescription
playerPlayer?If the event is attached in the client this argument won't exist. If attached in the server the first argument will represent the Player that fire the signal
argumentsTupleThe arguments passed thru the network

Returns:

NameTypeDescription
connectionProNet.ConnectionA connection that represents the event created. Allows you to disconnect the event at any point in the future

Example:

🟩Server:

--Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

--Dependencies
local ProNet = require(ReplicatedStorage.ProNet)

local testSignal : ProNet.Signal = ProNet.newSignal("TestSignal", {
signalType = ProNet.SignalType.Event,
protected = false,
requestLimit = 5,
requestResetTime = 3
})

task.wait(5)

testSignal:fireAll("Hello clients!")

🟦Client:

--Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")

--Dependencies
local ProNet = require(ReplicatedStorage.ProNet)
local testSignal : ProNet.Signal = ProNet.getSignal("TestSignal")

local connection : ProNet.Connection = testSignal.Event:Connect(function(message : string)
print(message) -- Won't output anything cause the event will be disconnected before the server fires it
end)

task.wait(2)

connection:Disconnect()