Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/nnaridz/RbxGenie/llms.txt

Use this file to discover all available pages before exploring further.

Get Script Source

Retrieve the complete source code from any script instance.
{
  "path": "ServerScriptService.MainScript"
}
Scripts must have their source accessible to the plugin. If you get an error about permissions, ensure RbxGenie has Script Injection permissions.

Set Complete Script Source

Replace the entire source code of a script.
{
  "path": "ServerScriptService.HelloWorld",
  "source": "print('Hello, World!')\nprint('Second line')"
}

Edit Specific Lines

Replace a range of lines in a script without rewriting the entire file.

Replace Single Line

{
  "path": "ServerScriptService.MainScript",
  "startLine": 3,
  "endLine": 3,
  "replacement": "\tprint('Player joined:', player.Name)"
}

Replace Multiple Lines

-- Line 1: local Players = game:GetService("Players")
-- Line 2:
-- Line 3: Players.PlayerAdded:Connect(function(player)
-- Line 4:     print(player.Name .. " joined!")
-- Line 5: end)
Line numbers are 1-indexed. Use get_script_source first to see line counts and plan your edits.

Insert Lines

Add new lines at any position in a script.

Insert at Beginning

{
  "path": "ServerScriptService.MainScript",
  "afterLine": 0,
  "lines": "-- Main game script\n-- Author: YourName"
}

Insert in Middle

{
  "path": "ServerScriptService.MainScript",
  "afterLine": 2,
  "lines": "local ReplicatedStorage = game:GetService('ReplicatedStorage')\nlocal config = require(ReplicatedStorage.Config)"
}

Append to End

{
  "path": "ServerScriptService.MainScript",
  "afterLine": 5,
  "lines": "\nPlayers.PlayerRemoving:Connect(function(player)\n\tprint(player.Name .. ' left')\nend)"
}

Delete Lines

Remove specific lines from a script.
{
  "path": "ServerScriptService.MainScript",
  "startLine": 2,
  "endLine": 2
}

Common Patterns

Add Function to Existing Script

  1. Get the source to find where to insert
  2. Use insert_script_lines to add the function

Refactor Script Incrementally

  1. Get current source
  2. Edit specific sections with edit_script_lines
  3. Insert new code with insert_script_lines
  4. Delete obsolete lines with delete_script_lines

Create New Script from Scratch

{
  "path": "ServerScriptService",
  "className": "Script",
  "properties": {
    "Name": "PlayerDataManager"
  },
  "source": "local Players = game:GetService('Players')\nlocal DataStoreService = game:GetService('DataStoreService')\n\nlocal playerData = DataStoreService:GetDataStore('PlayerData')\n\nPlayers.PlayerAdded:Connect(function(player)\n\tlocal data = playerData:GetAsync(player.UserId)\n\tif not data then\n\t\tdata = { coins = 0, level = 1 }\n\tend\n\tprint('Loaded data for', player.Name)\nend)"
}

Error Handling

Common errors when editing scripts:
  • “Cannot read source”: Script lacks read permissions
  • “Not a script”: Target instance is not a Script, LocalScript, or ModuleScript
  • Line out of range: startLine or endLine exceeds the script’s line count

Check Script Type Before Editing

{
  "path": "ServerScriptService.MyScript"
}

Next Steps

Playtest Automation

Test scripts in Play Mode programmatically

Bulk Operations

Modify multiple scripts efficiently