This page is about a feature exclusive to Pro/Elite subscribers, or to players in a Game created by a subscriber. If you'd like to use this feature, consider upgrading your account.
Mod Scripts provide a powerful way to customize and enhance your game. You create code scripts that instruct Roll20 during gameplay, like moving a piece, adding status markers to tokens, or rolling dice. Using Mod Scripts is simple and straightforward to get started, but the possibilities are endless.
Games can run Mod Script Sandbox v1.0 or Mod Script Sandbox v1.5. Scripts can read Campaign().sandboxVersion, which is "1.0" or "1.5". v1.5 includes everything in v1.0 plus additional functions and object methods. See Mod Scripts: Function Documentation and Mod Scripts: Objects.
Mod Script guides and documentation
- Mod Scripts: Advanced Examples
- Mod Scripts: Advanced Use Guide
- Mod Scripts: Sandbox Model
- Mod Scripts: Function Documentation
- Mod Scripts: Objects
- Mod Scripts: Chat
- Mod Scripts: Events
- Mod Scripts: Utility Functions
- Mod Scripts: Debugging
How do I install a Mod Script using the one-click script library?
- Navigate to the game landing page for the desired game.
- Click the Settings dropdown and select Mod Scripts.
- In the Script Library dropdown, locate the needed script.
- Click the Add Script button.
- You can now start using the script in your game!
How do I install a Mod Script if I want to write my own code or I want to use code from an external source?
- Navigate to the game landing page for the desired game.
- Click the Settings dropdown and select Mod Scripts.
- In the Mod Scripts Settings page, click the New Script tab.
- You’ll be taken to a code editor window where you can insert your script code and name the script.
- Copy-paste the script code and provide a name for the script.
- Click the Save Script button.
- The Mod Script Sandbox will restart, and you can now start using the script in-game.
If I want to write a script, what do I need to get started?
Scripts for Roll20 Mod Scripts are written in JavaScript. You only need a basic understanding of the language to get started, but if you want to learn more about JavaScript, this Codecademy course can help teach you.
To get started, your first stop should be the Advanced Use Guide.
Help! I can’t get my script to work!
If you’re looking for general assistance with Mod Script troubleshooting, check out our article here. If you are looking for more advanced debugging advice and information, check out our article here. If you’re still having issues, feel free to create a post on our Mod Scripts Forum.