AntiRaidAntiRaid

Templating

Write Luau scripts to fully customise how AntiRaid responds to events in your server.

Updated April 11, 2026

AntiRaid's templating system lets you write custom logic that runs inside the bot. Instead of being limited to preset commands, you can define exactly what happens when a member joins, a message is sent, or any other event fires.

Scripts are written in Luau — the scripting language used in Roblox, based on Lua 5.1. If you've written Lua before, Luau will feel immediately familiar.

Documentation in progress

The templating system is fully live, but detailed API documentation is still being written. The information here covers the basics — deeper API references are added regularly.

Why Luau?

Most bots either offer no scripting at all, or use a proprietary mini-language with limited capability. AntiRaid chose Luau because it's:

  • Well documented — years of Roblox developer resources cover the language thoroughly
  • Sandboxed — scripts run in an isolated environment and can't access anything outside what AntiRaid explicitly exposes
  • Fast — Luau is compiled and significantly faster than interpreted Lua
  • Safe — resource limits (CPU time, memory) are enforced per script to prevent abuse

What you can do with templates

  • Automate moderation — auto-ban accounts younger than a set age, auto-kick users with certain usernames, etc.
  • Custom welcome flows — send personalised welcome messages, assign roles based on invite used, or log joins to a private channel
  • Event-driven actions — respond to message edits, deletions, reactions, and more with custom logic
  • Custom commands — define your own slash commands that run Luau code

Getting started

Templates are created and managed through the AntiRaid dashboard. Navigate to your server's Templates section to create your first script.

A minimal template looks like this:

-- This runs every time a member joins
local member = event.member
local guild = event.guild

-- Log the join to a specific channel
antiraid.send_message({
  channel_id = "YOUR_CHANNEL_ID",
  content = member.username .. " joined the server.",
})

Further reading