> For the complete documentation index, see [llms.txt](https://docs.streamavatars.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/removeevent.md).

# removeEvent

{% hint style="success" %}
Click Events for a list of available events.
{% endhint %}

{% content-ref url="/pages/iqU0qDpy3WUjGbyDLU4V" %}
[Events](/lua-scripting-api/api-reference-and-tips/events.md)
{% endcontent-ref %}

```lua
--note this specific event has 2 parameters
function yourFunctionName(user, string_message)
    log(user.displayName .. ' has said ' .. string_message);
end
 
return function()
    
    --attaches the event to yourFunctionName()
    addEvent('chatMessage', 'yourFunctionName'); 
    wait(3);
    
    --unsubscribe your function from receiving events
    removeEvent('chatMessage'); 
    
    
    --make sure this script is kept alive so the event can be processed!
    keepAlive();
end
```

{% content-ref url="/pages/BZqDQ6dgraiWquJPmO26" %}
[keepAlive](/lua-scripting-api/api-reference-and-tips/global-functions/keepalive.md)
{% endcontent-ref %}

{% content-ref url="/pages/0HOYqU6agS16NIhwCm2P" %}
[Read Chat](/lua-scripting-api/api-reference-and-tips/events/read-chat.md)
{% endcontent-ref %}

{% content-ref url="/pages/gGva9j1R8pVpmKkSPxjm" %}
[addEvent](/lua-scripting-api/api-reference-and-tips/global-functions/addevent.md)
{% endcontent-ref %}
