Created
September 21, 2024 14:44
-
-
Save Rorythedev/00eec76a9566903521e0146d9a240531 to your computer and use it in GitHub Desktop.
gives you better developing! WARNING: this is in beta so it may contain bugs or glitches.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import json | |
import random | |
class RobloxDevHelper: | |
def __init__(self): | |
self.part_colors = { | |
"Red": (1, 0, 0), | |
"Green": (0, 1, 0), | |
"Blue": (0, 0, 1), | |
"Yellow": (1, 1, 0), | |
"Magenta": (1, 0, 1), | |
"Cyan": (0, 1, 1), | |
"White": (1, 1, 1), | |
"Black": (0, 0, 0) | |
} | |
def generate_color3(self, r, g, b): | |
"""Generate a Color3 string for Roblox Lua""" | |
return f"Color3.new({r}, {g}, {b})" | |
def random_color3(self): | |
"""Generate a random Color3 string""" | |
r, g, b = [random.random() for _ in range(3)] | |
return self.generate_color3(r, g, b) | |
def named_color3(self, color_name): | |
"""Get a Color3 string for a named color""" | |
if color_name in self.part_colors: | |
r, g, b = self.part_colors[color_name] | |
return self.generate_color3(r, g, b) | |
else: | |
return "Color not found" | |
def vector3(self, x, y, z): | |
"""Generate a Vector3 string for Roblox Lua""" | |
return f"Vector3.new({x}, {y}, {z})" | |
def cframe(self, x, y, z): | |
"""Generate a CFrame string for Roblox Lua""" | |
return f"CFrame.new({x}, {y}, {z})" | |
def parse_roblox_script(self, script): | |
"""Parse a Roblox Lua script and extract function names""" | |
function_pattern = r"function\s+(\w+)\s*\(" | |
functions = re.findall(function_pattern, script) | |
return functions | |
def generate_tool_template(self, tool_name): | |
"""Generate a basic tool script template""" | |
template = f""" | |
local tool = script.Parent | |
local function onActivated() | |
print("{tool_name} was activated!") | |
-- Add your tool's behavior here | |
end | |
tool.Activated:Connect(onActivated) | |
""" | |
return template | |
def export_to_json(self, data, filename): | |
"""Export data to a JSON file""" | |
with open(filename, 'w') as f: | |
json.dump(data, f, indent=4) | |
print(f"Data exported to {filename}") | |
# Usage example | |
helper = RobloxDevHelper() | |
print(helper.generate_color3(0.5, 0.7, 0.9)) | |
print(helper.random_color3()) | |
print(helper.named_color3("Red")) | |
print(helper.vector3(10, 20, 30)) | |
print(helper.cframe(5, 5, 5)) | |
sample_script = """ | |
function onPlayerJoin(player) | |
print("Player joined!") | |
end | |
function onPlayerLeave(player) | |
print("Player left!") | |
end | |
""" | |
functions = helper.parse_roblox_script(sample_script) | |
print("Functions found:", functions) | |
tool_script = helper.generate_tool_template("MagicWand") | |
print(tool_script) | |
data_to_export = { | |
"PartColors": helper.part_colors, | |
"SampleVector": helper.vector3(1, 2, 3) | |
} | |
helper.export_to_json(data_to_export, "roblox_data.json") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment