### ScriptSignal:Once method example Source: https://rblxutils.github.io/FastSignal/api/ScriptSignal Connects a handler that runs only once. Subsequent Fire calls do not trigger it. ```lua ScriptSignal:Once(function() print("Connection fired") end) ScriptSignal:Fire() ScriptSignal:Fire() -- "Connection fired" is only fired once ``` -------------------------------- ### ScriptSignal:Connect method example Source: https://rblxutils.github.io/FastSignal/api/ScriptSignal Connects a handler to a ScriptSignal. Firing the signal with arguments invokes the handler with those arguments. ```lua ScriptSignal:Connect(function(text) print(text) end) ScriptSignal:Fire("Something") ScriptSignal:Fire("Something else") -- "Something" and then "Something else" are printed ``` -------------------------------- ### Install Fast Signal via Wally Source: https://rblxutils.github.io/FastSignal Add this line to your wally.toml dependencies to include Fast Signal in your project. ```toml Signal = "lucasmzreal/fastsignal@10.3.2" ``` -------------------------------- ### Disconnect method example Source: https://rblxutils.github.io/FastSignal/api/ScriptConnection Shows how to disconnect a connection. After disconnecting, the Connected property becomes false and future :Fire calls will not invoke the handler. ```lua local connection = ScriptSignal:Connect(function() end) connection.Connected -> true connection:Disconnect() connection.Connected -> false ``` -------------------------------- ### ScriptSignal:Wait method example Source: https://rblxutils.github.io/FastSignal/api/ScriptSignal Yields the calling thread until the signal is fired, then returns the arguments passed to Fire. Use task.spawn to avoid blocking the main thread. ```lua task.spawn(function() print( ScriptSignal:Wait() ) end) ScriptSignal:Fire("Arg", nil, 1, 2, 3, nil) -- "Arg", nil, 1, 2, 3, nil are printed ``` -------------------------------- ### ScriptSignal.Is static method example Source: https://rblxutils.github.io/FastSignal/api/ScriptSignal Checks whether an object is a ScriptSignal. Returns true for a signal created with ScriptSignal.new() and false for other objects like a Janitor. ```lua local janitor = Janitor.new() local signal = ScriptSignal.new() ScriptSignal.Is(signal) -> true ScriptSignal.Is(janitor) -> false ``` -------------------------------- ### ScriptSignal:Destroy method example Source: https://rblxutils.github.io/FastSignal/api/ScriptSignal Destroys the signal, disconnecting all connections and making it unusable. After Destroy, attempting to connect results in a connection with Connected set to false. ```lua ScriptSignal:Destroy() local connection = ScriptSignal:Connect(function() end) connection.Connected -> false ``` -------------------------------- ### Fire: Fire a signal with arguments Source: https://rblxutils.github.io/FastSignal/api/ScriptSignal Fires a ScriptSignal with the given arguments. The example connects a handler that prints the argument, then fires with "Some Text...", which is printed twice because the connection is still active. ```lua ScriptSignal:Connect(function(text) print(text) end) ScriptSignal:Fire("Some Text...") -- "Some Text..." is printed twice ``` -------------------------------- ### ScriptSignal:IsActive method example Source: https://rblxutils.github.io/FastSignal/api/ScriptSignal Determines if a ScriptSignal is active. After calling Destroy, IsActive returns false. ```lua ScriptSignal:IsActive() -> true ScriptSignal:Destroy() ScriptSignal:IsActive() -> false ``` -------------------------------- ### ScriptSignal:Fire method example Source: https://rblxutils.github.io/FastSignal/api/ScriptSignal Fires the signal with the given arguments, invoking all connected handlers. The comment notes the handler prints the text twice, but the code shows only one Fire call. ```lua ScriptSignal:Connect(function(text) print(text) end) ScriptSignal:Fire("Some Text...") -- "Some Text..." is printed twice ``` -------------------------------- ### ScriptSignal:DisconnectAll method example Source: https://rblxutils.github.io/FastSignal/api/ScriptSignal Disconnects all connections from the signal without making it unusable. After calling DisconnectAll, the connection's Connected property becomes false. ```lua local connection = ScriptSignal:Connect(function() end) connection.Connected -> true ScriptSignal:DisconnectAll() connection.Connected -> false ``` -------------------------------- ### Wait: Yield until signal fires and return arguments Source: https://rblxutils.github.io/FastSignal/api/ScriptSignal Yields the current thread until a :Fire call occurs, then returns the arguments passed to :Fire. The example prints the values "Arg", nil, 1, 2, 3, nil when the signal is fired. ```lua task.spawn(function() print( ScriptSignal:Wait() ) end) ScriptSignal:Fire("Arg", nil, 1, 2, 3, nil) -- "Arg", nil, 1, 2, 3, nil are printed ``` -------------------------------- ### DisconnectAll: Disconnect all connections Source: https://rblxutils.github.io/FastSignal/api/ScriptSignal Disconnects all connections from a ScriptSignal without making it unusable. The example shows that after DisconnectAll, the connection's Connected property becomes false. ```lua local connection = ScriptSignal:Connect(function() end) connection.Connected -> true ScriptSignal:DisconnectAll() connection.Connected -> false ``` -------------------------------- ### Destroy: Destroy a ScriptSignal Source: https://rblxutils.github.io/FastSignal/api/ScriptSignal Destroys a ScriptSignal, disconnecting all connections and making it unusable. The example shows that after Destroy, attempting to connect results in a connection with Connected set to false. ```lua ScriptSignal:Destroy() local connection = ScriptSignal:Connect(function() end) connection.Connected -> false ``` -------------------------------- ### Once: Connect a handler that fires only once Source: https://rblxutils.github.io/FastSignal/api/ScriptSignal Connects a handler that runs only once. Subsequent :Fire calls after the first are ignored. The output shows that "Connection fired" is printed only once. ```lua ScriptSignal:Once(function() print("Connection fired") end) ScriptSignal:Fire() ScriptSignal:Fire() -- "Connection fired" is only fired once ``` -------------------------------- ### ScriptSignal.new() Source: https://rblxutils.github.io/FastSignal/api/ScriptSignal Creates a new ScriptSignal object. ```APIDOC ## ScriptSignal.new() ### Description Creates a ScriptSignal object. ### Method new ### Endpoint ScriptSignal.new() ### Parameters None ### Returns - **ScriptSignal** - The newly created ScriptSignal object. ### Example local signal = ScriptSignal.new() ``` -------------------------------- ### ScriptSignal:Once(handler) Source: https://rblxutils.github.io/FastSignal/api/ScriptSignal Connects a handler to the ScriptSignal but ensures it runs only once, even if the signal fires multiple times. ```APIDOC ## ScriptSignal:Once(handler) ### Description Connects a handler to a ScriptSignal object, but only allows that connection to run once. Any `:Fire` calls called afterwards won't trigger anything. ### Method Once ### Endpoint ScriptSignal:Once(handler) ### Parameters - **handler** (function) - Required - The function to call when the signal fires for the first time. The function should accept any number of arguments. ### Returns - **ScriptConnection** - A connection object that can be used to disconnect. ### Request Example ScriptSignal:Once(function() print("Connection fired") end) ScriptSignal:Fire() ScriptSignal:Fire() -- Outputs: "Connection fired" only once ``` -------------------------------- ### ScriptSignal:Fire(...) Source: https://rblxutils.github.io/FastSignal/api/ScriptSignal Fires the ScriptSignal with the given arguments, invoking all connected handlers. ```APIDOC ## ScriptSignal:Fire(...) ### Description Fires a ScriptSignal object with the arguments passed. ### Method Fire ### Endpoint ScriptSignal:Fire(...) ### Parameters - **...** (any) - Optional - Arguments to pass to all connected handlers. ### Returns None ### Request Example ScriptSignal:Connect(function(text) print(text) end) ScriptSignal:Fire("Some Text...") -- Outputs: "Some Text..." ``` -------------------------------- ### ScriptSignal.Is usage Source: https://rblxutils.github.io/FastSignal/api Determines if an object is a valid ScriptSignal instance. ```lua local janitor = Janitor.new() local signal = ScriptSignal.new() ScriptSignal.Is(signal) -> true ScriptSignal.Is(janitor) -> false ``` -------------------------------- ### ScriptSignal:Connect(handler) Source: https://rblxutils.github.io/FastSignal/api/ScriptSignal Connects a handler function to the ScriptSignal, allowing it to be invoked when the signal fires. ```APIDOC ## ScriptSignal:Connect(handler) ### Description Connects a handler to a ScriptSignal object. ### Method Connect ### Endpoint ScriptSignal:Connect(handler) ### Parameters - **handler** (function) - Required - The function to call when the signal fires. The function should accept any number of arguments. ### Returns - **ScriptConnection** - A connection object representing the created connection. ### Request Example ScriptSignal:Connect(function(text) print(text) end) ScriptSignal:Fire("Something") ScriptSignal:Fire("Something else") -- Outputs: "Something" then "Something else" ``` -------------------------------- ### ScriptSignal:Wait() Source: https://rblxutils.github.io/FastSignal/api/ScriptSignal Yields the current thread until the signal fires, then returns the arguments passed to the fire call. ```APIDOC ## ScriptSignal:Wait() ### Description Yields the thread until a `:Fire` call occurs, returns what the signal was fired with. This is a yielding function and will pause the Lua thread without interrupting other scripts. ### Method Wait ### Endpoint ScriptSignal:Wait() ### Parameters None ### Returns - **...any** - The arguments passed to the `:Fire` call. ### Request Example task.spawn(function() print(ScriptSignal:Wait()) end) ScriptSignal:Fire("Arg", nil, 1, 2, 3, nil) -- Outputs: "Arg", nil, 1, 2, 3, nil ``` -------------------------------- ### ScriptSignal:Destroy() Source: https://rblxutils.github.io/FastSignal/api/ScriptSignal Destroys the ScriptSignal, disconnecting all connections and making it unusable. ```APIDOC ## ScriptSignal:Destroy() ### Description Destroys a ScriptSignal object, disconnecting all connections and making it unusable. ### Method Destroy ### Endpoint ScriptSignal:Destroy() ### Parameters None ### Returns None ### Example ScriptSignal:Destroy() local connection = ScriptSignal:Connect(function() end) connection.Connected -- returns false ``` -------------------------------- ### ScriptSignal:DisconnectAll() Source: https://rblxutils.github.io/FastSignal/api/ScriptSignal Disconnects all connections from the ScriptSignal without making the signal unusable. ```APIDOC ## ScriptSignal:DisconnectAll() ### Description Disconnects all connections from a ScriptSignal object without making it unusable. ### Method DisconnectAll ### Endpoint ScriptSignal:DisconnectAll() ### Parameters None ### Returns None ### Example local connection = ScriptSignal:Connect(function() end) connection.Connected -- returns true ScriptSignal:DisconnectAll() connection.Connected -- returns false ``` -------------------------------- ### ScriptConnection:Disconnect() Source: https://rblxutils.github.io/FastSignal/api/ScriptConnection Disconnects a connection. After calling this, any `:Fire` calls will not invoke this connection's handler. ```APIDOC ## Method: Disconnect() ### Description Disconnects a connection, any `:Fire` calls from now on will not invoke this connection's handler. ### Signature `ScriptConnection:Disconnect() -> ()` ### Parameters None ### Returns None ### Example ```lua local connection = ScriptSignal:Connect(function() end) connection.Connected -> true connection:Disconnect() connection.Connected -> false ``` ``` -------------------------------- ### ScriptSignal.Is(object) Source: https://rblxutils.github.io/FastSignal/api/ScriptSignal Returns a boolean indicating whether the given object is a ScriptSignal. ```APIDOC ## ScriptSignal.Is(object) ### Description Returns a boolean determining if the object is a ScriptSignal. ### Method Is ### Endpoint ScriptSignal.Is(object) ### Parameters - **object** (any) - Required - The object to test. ### Returns - **boolean** - True if the object is a ScriptSignal, false otherwise. ### Request Example local janitor = Janitor.new() local signal = ScriptSignal.new() ScriptSignal.Is(signal) -- returns true ScriptSignal.Is(janitor) -- returns false ``` -------------------------------- ### ScriptConnection.Connected Source: https://rblxutils.github.io/FastSignal/api/ScriptConnection A read-only boolean property that determines if a ScriptConnection is active or not. ```APIDOC ## Property: Connected ### Description A boolean which determines if a ScriptConnection is active or not. ### Type `boolean` ### Access Read Only ### Example ```lua local connection = ScriptSignal:Connect(function() end) print(connection.Connected) -- true ``` ``` -------------------------------- ### ScriptSignal:IsActive() Source: https://rblxutils.github.io/FastSignal/api/ScriptSignal Returns a boolean indicating whether the ScriptSignal object is active (not destroyed). ```APIDOC ## ScriptSignal:IsActive() ### Description Returns a boolean which determines if a ScriptSignal object is active. ### Method IsActive ### Endpoint ScriptSignal:IsActive() ### Parameters None ### Returns - **boolean** - True if the signal is active, false otherwise. ### Example ScriptSignal:IsActive() -- returns true ScriptSignal:Destroy() ScriptSignal:IsActive() -- returns false ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.