VoltSignal.new
Creates a new VoltSignal instance.
Syntax
VoltSignal.new() -> VoltSignalParameters
This function takes no parameters.
Returns
| Type | Description |
|---|---|
VoltSignal | A new VoltSignal instance |
Description
VoltSignal.new creates a new signal object that can be used to implement custom events. The returned signal can have handlers connected to it and can be fired with arguments.
Example
-- Create a new signal
local onPlayerDamaged = VoltSignal.new()
-- Connect a handler
onPlayerDamaged:Connect(function(player, damage)
print(player.Name .. " took " .. damage .. " damage!")
end)
-- Fire the signal
onPlayerDamaged:Fire(game.Players.LocalPlayer, 50)Related Functions
VoltSignal:Connect- Connect a handlerVoltSignal:Fire- Fire the signal