> For the complete documentation index, see [llms.txt](https://refresh-cx.gitbook.io/refresh.cx-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://refresh-cx.gitbook.io/refresh.cx-docs/events/on-trigger-server-event.md).

# On Trigger Server Event

Sets (or with a falsy value, clears) the outgoing server-event callback. The callback receives the event name and the raw payload, and returns the name and payload to send. Returning nothing, or an unchanged pair, sends the event untouched; anything else resends the rewritten event and blocks the original.

## **Syntax**

```lua
refresh.Events.OnTriggerServerEvent(fn)
```

## Usage Example

```lua
refresh.Events.OnTriggerServerEvent(function(name, payload)
    if name == "_chat:messageEntered" then
        return nil
    end
    return name, payload
end)
```
