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.
Simple Script
Complex Script
Response
{
"path" : "ServerScriptService.HelloWorld" ,
"source" : "print('Hello, World!') \n print('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" : " \t print('Player joined:', player.Name)"
}
Replace Multiple Lines
Original Script (lines 1-5)
Replace Lines 3-4
Response
-- 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') \n local config = require(ReplicatedStorage.Config)"
}
Append to End
{
"path" : "ServerScriptService.MainScript" ,
"afterLine" : 5 ,
"lines" : " \n Players.PlayerRemoving:Connect(function(player) \n\t print(player.Name .. ' left') \n end)"
}
Delete Lines
Remove specific lines from a script.
Delete Single Line
Delete Range
Response
{
"path" : "ServerScriptService.MainScript" ,
"startLine" : 2 ,
"endLine" : 2
}
Common Patterns
Add Function to Existing Script
Get the source to find where to insert
Use insert_script_lines to add the function
{
"path" : "ServerScriptService.Utils"
}
{
"path" : "ServerScriptService.Utils" ,
"afterLine" : 10 ,
"lines" : " \n local function calculateDistance(pos1, pos2) \n\t return (pos1 - pos2).Magnitude \n end \n\n return { calculateDistance = calculateDistance }"
}
Refactor Script Incrementally
Get current source
Edit specific sections with edit_script_lines
Insert new code with insert_script_lines
Delete obsolete lines with delete_script_lines
Update Service References
{
"path" : "ServerScriptService.GameLoop" ,
"startLine" : 1 ,
"endLine" : 1 ,
"replacement" : "local Players = game:GetService('Players') \n local ReplicatedStorage = game:GetService('ReplicatedStorage') \n local RunService = game:GetService('RunService')"
}
Create New Script from Scratch
Using create_object_with_properties
Response
{
"path" : "ServerScriptService" ,
"className" : "Script" ,
"properties" : {
"Name" : "PlayerDataManager"
},
"source" : "local Players = game:GetService('Players') \n local DataStoreService = game:GetService('DataStoreService') \n\n local playerData = DataStoreService:GetDataStore('PlayerData') \n\n Players.PlayerAdded:Connect(function(player) \n\t local data = playerData:GetAsync(player.UserId) \n\t if not data then \n\t\t data = { coins = 0, level = 1 } \n\t end \n\t print('Loaded data for', player.Name) \n end)"
}
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
Get Instance Properties
Response
{
"path" : "ServerScriptService.MyScript"
}
Next Steps
Playtest Automation Test scripts in Play Mode programmatically
Bulk Operations Modify multiple scripts efficiently