Skip to main content
A BAR plugin is a Lua ModuleScript placed in a Plugins folder inside the main BAR script. It defines a single custom command — its name, permission level, prefix, and the function to run when a player triggers it. Because BAR discovers plugins at startup, you never need to touch any core file.
1

Create the Plugins folder

In ServerScriptService, locate your BAR script (the model you placed there during setup). Insert a new Folder as a direct child of that script and name it exactly Plugins.
2

Insert a ModuleScript

Inside the Plugins folder, insert a new ModuleScript. Give it a descriptive name (e.g. AnnouncePlugin) — the name of the ModuleScript itself is not used by BAR, only the values you return from the function matter.
3

Write the plugin code

Replace the default ModuleScript contents with your plugin, following the contract shown in the template below. The Plugin Contract section of the overview explains every value BAR expects you to return.
4

Playtest

Hit Play in Studio (or publish and start a live server). Your command will be registered automatically and will appear in :cmds alongside all built-in commands.

Official Plugin Template

The file below is the unmodified plugin_script.lua shipped with BAR. Copy it as your starting point.

Template Breakdown

pluginName

The command name without its prefix. Whatever string you set here is what players type after the prefix to trigger the command.

pluginPrefix

Which prefix character activates the command. Set it to:
  • actionPrefix — uses ! (the action prefix, e.g. !help)
  • Prefix — uses : (the standard admin prefix, e.g. :help)

pluginLevel

The minimum permission level a player must have to run the command. BAR uses four levels above the default:

pluginUsage

A short argument description displayed next to the command name in :cmds. Leave it as an empty string ("") if the command takes no arguments.

pluginDescription

A one-line description of what the command does. Shown alongside pluginUsage in :cmds.

pluginFunction(Args)

The handler that runs when the command is triggered. Always keep the function named pluginFunction — BAR expects that exact identifier when registering the command. The Args table is structured as follows:

The return statement

The final return at the bottom of the Plugin function ships everything BAR needs to register your command. All five values are required — do not omit any of them.

Real-World Example: :announce <text>

The following plugin adds a :announce <text> command (admin-only) that fires a server-wide notification to every connected player.
Call returnPermissions(player) inside pluginFunction whenever you need to gate part of your logic on a player’s rank — for example, to let admins target other admins but not super admins. The function returns an integer 0–4 that you can compare directly with >=, ==, etc.
Treat returnPermissions, Commands, and all other values unpacked from Data[1] as read-only. Never reassign or mutate these tables. Modifying them will corrupt BAR’s internal state for the entire server session and may silently break unrelated commands.
The !help example bundled in plugin_script.lua is a practical demonstration of returnPermissions in action. When a player runs !help, the handler iterates over every online player and fires a notification only to those whose permission level is >= 1 (i.e. moderators and above). This makes it easy to page all active admins without exposing their identities to regular players.