Skip to content

patangation/roblox-script-exporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Roblox Script Exporter

A powerful Lua script that exports all scripts from Roblox place files (.rbxl) into organized directory structures, making it easy to version control, review, and manage your Roblox game code.

🚀 Features

  • Complete Script Export: Extracts all Script, LocalScript, and ModuleScript instances from .rbxl files
  • Organized Structure: Maintains Roblox service hierarchy (ServerScriptService, ReplicatedStorage, etc.)
  • Nested Script Support: Handles scripts inside other scripts with special _contents folders
  • Rich Metadata: Preserves script properties, paths, and export information in file headers
  • Smart File Extensions:
    • .server.lua for Server Scripts
    • .client.lua for Local Scripts
    • .lua for Module Scripts
  • Clean Naming: Sanitizes file and folder names for filesystem compatibility

📋 Prerequisites

  • Lune - A standalone Luau runtime
  • A Roblox place file (.rbxl) to export from

Installing Lune

Windows (using Scoop):

scoop install lune

Windows (using Chocolatey):

choco install lune

macOS (using Homebrew):

brew install lune

Linux or manual installation: Download from the Lune releases page

🎯 Usage

Basic Usage

lune run export-scripts.lua MyGame.rbxl

This will create a folder named MyGame-scripts/ with all exported scripts.

Custom Output Directory

lune run export-scripts.lua MyGame.rbxl my-custom-folder

Example Output Structure

MyGame-scripts/
├── project-info.lua                 # Export metadata
├── ServerScriptService/
│   ├── MainScript.server.lua
│   └── Services/
│       ├── PlayerManager.lua
│       └── GameManager.lua
├── ReplicatedStorage/
│   ├── Shared/
│   │   ├── Config.lua
│   │   └── Utilities.lua
│   └── Packages/
│       ├── Promise.lua
│       └── Signal.lua
└── StarterPlayer/
    └── StarterPlayerScripts/
        └── ClientMain.client.lua

📂 Project Structure

  • export-scripts.lua - Main exporter script
  • export-scripts.exe - Pre-compiled Windows executable (if available)
  • rokit.toml - Rokit configuration for dependency management
  • Example game files and exported scripts for reference

🔧 Configuration

The exporter can be customized by modifying the CONFIG table in export-scripts.lua:

local CONFIG = {
    -- File extensions for different script types
    extensions = {
        Script = ".server.lua",
        LocalScript = ".client.lua", 
        ModuleScript = ".lua"
    },
    
    -- Services to export (in priority order)
    services = {
        "ServerScriptService",
        "ReplicatedStorage", 
        "ServerStorage",
        "StarterPlayer",
        -- ... add more services as needed
    },
    
    -- Skip these instances completely
    skipInstances = {
        "Camera",
        "Terrain"
    }
}

🏗️ How It Works

  1. Reads the .rbxl file and deserializes it using Lune's Roblox API
  2. Traverses each configured service (ServerScriptService, ReplicatedStorage, etc.)
  3. Identifies all script instances recursively, including nested scripts
  4. Extracts source code and metadata from each script
  5. Organizes scripts into a clean directory structure
  6. Preserves important information like script properties and hierarchy in file headers

📝 Script Headers

Each exported script includes a comprehensive header with metadata:

--[[
    PlayerManager (ModuleScript)
    Path: ServerScriptService → Services
    Parent: Services
    Properties:
        Disabled: false
    Exported: 2025-06-27 14:30:15
]]

-- Your script code here...

🤝 Contributing

Contributions are welcome! Here are some ways you can help:

  • Bug Reports: Found an issue? Please open an issue with details
  • Feature Requests: Have an idea? Let's discuss it in the issues
  • Pull Requests: Ready to contribute code? Please follow these steps:
    1. Fork the repository
    2. Create a feature branch (git checkout -b feature/amazing-feature)
    3. Commit your changes (git commit -m 'Add amazing feature')
    4. Push to the branch (git push origin feature/amazing-feature)
    5. Open a Pull Request

🐛 Troubleshooting

Common Issues

"Module not found" errors

  • Ensure Lune is properly installed and in your PATH
  • Try running lune --version to verify installation

"Permission denied" errors

  • Make sure you have write permissions in the output directory
  • Try running as administrator on Windows if needed

Empty output or missing scripts

  • Check that your .rbxl file isn't corrupted
  • Verify the file path is correct
  • Some scripts might be in services not included in the CONFIG

Getting Help

  • Check existing Issues for similar problems
  • Open a new issue with:
    • Your operating system
    • Lune version (lune --version)
    • Error message or unexpected behavior
    • Sample .rbxl file (if possible)

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Lune - For providing an excellent Luau runtime
  • Roblox community - For inspiration and feedback
  • Contributors - Thank you for making this project better!

📊 Stats

  • Supports unlimited nesting depth (with safety limits)
  • Handles all standard Roblox script types
  • Preserves script properties and metadata
  • Cross-platform compatible (Windows, macOS, Linux)

Made with ❤️ for the Roblox development community

About

Extract and organize Lua scripts from Roblox place files (.rbxl) using Lune runtime

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages