Volt

VoltSignal.new

Creates a new VoltSignal instance.

Syntax

VoltSignal.new() -> VoltSignal

Parameters

This function takes no parameters.

Returns

TypeDescription
VoltSignalA 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)

On this page