
KeylessUniversal

--[[
╔══════════════════════════════════════════════════════════════════╗
║ AI HORDE TOOL FORGER V3 - PURE PROMPT FORGE ║
║ Type ANY idea - AI creates the ENTIRE tool instantly! ║
║ ║
║ FEATURES: ║
║ - Single prompt creates everything (name, desc, script, mesh) ║
║ - GenerationService:GenerateModelAsync (Roblox Cube 3D AI) ║
║ - AI Horde Image Generation (Stable Diffusion SDXL) ║
║ - AI Horde Text Generation (LLM) for complete tool scripting ║
║ - writefile / getcustomasset for persistent textures ║
║ - Smart fallback: Cube3D -> Horde Image -> Procedural ║
║ - PROPER SCRIPT INJECTION - Tools actually work! ║
║ ║
║ Executor: Synapse X, Script-Ware, Fluxus, Xeno, Delta, etc. ║
╚══════════════════════════════════════════════════════════════════╝
--]]
--// Services
local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
-- Try to get GenerationService (Roblox Cube 3D)
local GenerationService = nil
pcall(function()
GenerationService = game:GetService("GenerationService")
end)
--// Player
local Player = Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
--// Config
local CONFIG = {
HORDE_BASE = "https://stablehorde.net/api",
ANON_KEY = "0000000000",
SAVE_DIR = "horde_tools",
MAX_POLLS = 120,
POLL_INTERVAL = 3,
IMAGE_WIDTH = 512,
IMAGE_HEIGHT = 512,
STEPS = 30,
CFG_SCALE = 7,
DEFAULT_MODEL = "AlbedoBase XL (SDXL)",
CUBE3D_TRI_MAX = 500,
CUBE3D_SIZE = Vector3.new(2, 3, 2),
}
--// Utilities
local function SanitizeFilename(name)
return name:gsub("[^%w%s%-]", ""):gsub("%s+", "_"):sub(1, 30)
end
local function DownloadPath(filename)
return CONFIG.SAVE_DIR .. "/" .. filename .. ".png"
end
-- HTTP wrapper with retry
local function SafeHttpRequest(method, url, body, content_type)
local success, result = pcall(function()
local options = {
Url = url,
Method = method,
Headers = {
["Content-Type"] = content_type or "application/json",
["apikey"] = CONFIG.ANON_KEY
}
}
if body then
options.Body = body
end
return HttpService:RequestAsync(options)
end)
if success and result.Success then
return result.Body
elseif success then
warn("HTTP request failed: " .. result.StatusCode .. " - " .. result.StatusMessage)
return nil
else
warn("HTTP request error: " .. tostring(result))
return nil
end
end
-- =====================================================================
-- GUI CONSTRUCTION (MINIMAL - FOCUS ON PROMPT)
-- =====================================================================
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "HordeToolForgeV3"
ScreenGui.ResetOnSpawn = false
ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
ScreenGui.IgnoreGuiInset = true
ScreenGui.Parent = PlayerGui
-- Main Frame (smaller, focused)
local MainFrame = Instance.new("Frame")
MainFrame.Name = "MainFrame"
MainFrame.Size = UDim2.new(0, 480, 0, 500)
MainFrame.Position = UDim2.new(0.5, -240, 0.5, -250)
MainFrame.BackgroundColor3 = Color3.fromRGB(12, 12, 18)
MainFrame.BorderSizePixel = 0
MainFrame.ClipsDescendants = true
MainFrame.Parent = ScreenGui
Instance.new("UICorner", MainFrame).CornerRadius = UDim.new(0, 12)
local MainStroke = Instance.new("UIStroke")
MainStroke.Color = Color3.fromRGB(100, 60, 255)
MainStroke.Thickness = 1.5
MainStroke.Parent = MainFrame
-- Draggable
local dragging, dragInput, dragStart, startPos
MainFrame.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
dragging = true; dragStart = input.Position; startPos = MainFrame.Position
input.Changed:Connect(function()
if input.UserInputState == Enum.UserInputState.End then dragging = false end
end)
end
end)
MainFrame.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
dragInput = input
end
end)
UserInputService.InputChanged:Connect(function(input)
if input == dragInput and dragging then
local delta = input.Position - dragStart
MainFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
end
end)
-- Title Bar
local TitleBar = Instance.new("Frame")
TitleBar.Size = UDim2.new(1, 0, 0, 42)
TitleBar.BackgroundColor3 = Color3.fromRGB(18, 18, 28)
TitleBar.BorderSizePixel = 0
TitleBar.Parent = MainFrame
Instance.new("UICorner", TitleBar).CornerRadius = UDim.new(0, 12)
local AccentLine = Instance.new("Frame")
AccentLine.Size = UDim2.new(1, 0, 0, 2)
AccentLine.Position = UDim2.new(0, 0, 1, -2)
AccentLine.BackgroundColor3 = Color3.fromRGB(140, 80, 255)
AccentLine.BorderSizePixel = 0
AccentLine.Parent = TitleBar
local TitleLabel = Instance.new("TextLabel")
TitleLabel.Size = UDim2.new(1, -80, 1, 0)
TitleLabel.Position = UDim2.new(0, 16, 0, 0)
TitleLabel.BackgroundTransparency = 1
TitleLabel.Text = "🤖 AI Prompt Forge"
TitleLabel.TextColor3 = Color3.fromRGB(200, 180, 255)
TitleLabel.TextSize = 16
TitleLabel.Font = Enum.Font.GothamBold
TitleLabel.TextXAlignment = Enum.TextXAlignment.Left
TitleLabel.Parent = TitleBar
local CloseBtn = Instance.new("TextButton")
CloseBtn.Size = UDim2.new(0, 28, 0, 28)
CloseBtn.Position = UDim2.new(1, -34, 0, 7)
CloseBtn.BackgroundColor3 = Color3.fromRGB(60, 40, 80)
CloseBtn.Text = "✕"
CloseBtn.TextColor3 = Color3.fromRGB(255, 120, 120)
CloseBtn.TextSize = 14
CloseBtn.Font = Enum.Font.GothamBold
CloseBtn.BorderSizePixel = 0
CloseBtn.Parent = TitleBar
Instance.new("UICorner", CloseBtn).CornerRadius = UDim.new(0, 8)
CloseBtn.MouseButton1Click:Connect(function() ScreenGui:Destroy() end)
-- Content area
local Content = Instance.new("ScrollingFrame")
Content.Name = "Content"
Content.Size = UDim2.new(1, -20, 1, -52)
Content.Position = UDim2.new(0, 10, 0, 48)
Content.BackgroundTransparency = 1
Content.ScrollBarThickness = 3
Content.ScrollBarImageColor3 = Color3.fromRGB(60, 50, 80)
Content.BorderSizePixel = 0
Content.AutomaticCanvasSize = Enum.AutomaticSize.Y
Content.CanvasSize = UDim2.new(0, 0, 0, 0)
Content.Parent = MainFrame
local ContentList = Instance.new("UIListLayout")
ContentList.SortOrder = Enum.SortOrder.LayoutOrder
ContentList.Padding = UDim.new(0, 8)
ContentList.Parent = Content
-- Main Prompt Label
local PromptLabel = Instance.new("TextLabel")
PromptLabel.Size = UDim2.new(1, 0, 0, 24)
PromptLabel.BackgroundTransparency = 1
PromptLabel.Text = "✨ Describe ANY tool idea:"
PromptLabel.TextColor3 = Color3.fromRGB(160, 140, 255)
PromptLabel.TextSize = 13
PromptLabel.Font = Enum.Font.GothamBold
PromptLabel.TextXAlignment = Enum.TextXAlignment.Left
PromptLabel.LayoutOrder = 1
PromptLabel.Parent = Content
-- Big Prompt Box
local PromptBox = Instance.new("TextBox")
PromptBox.Size = UDim2.new(1, 0, 0, 120)
PromptBox.BackgroundColor3 = Color3.fromRGB(22, 20, 32)
PromptBox.TextColor3 = Color3.fromRGB(240, 230, 255)
PromptBox.PlaceholderText = [[Example: "A crystal staff that shoots ice beams and creates frozen platforms" or "Flaming greatsword that leaves fire trails and explodes on impact"...]]
PromptBox.PlaceholderColor3 = Color3.fromRGB(60, 50, 80)
PromptBox.Text = ""
PromptBox.TextSize = 13
PromptBox.Font = Enum.Font.Gotham
PromptBox.BorderSizePixel = 0
PromptBox.ClearTextOnFocus = false
PromptBox.TextXAlignment = Enum.TextXAlignment.Left
PromptBox.TextYAlignment = Enum.TextYAlignment.Top
PromptBox.TextWrapped = true
PromptBox.LayoutOrder = 2
PromptBox.Parent = Content
Instance.new("UICorner", PromptBox).CornerRadius = UDim.new(0, 10)
Instance.new("UIPadding", PromptBox).PaddingLeft = UDim.new(0, 12)
Instance.new("UIPadding", PromptBox).PaddingTop = UDim.new(0, 10)
-- AI Enhance Toggle
local EnhanceFrame = Instance.new("Frame")
EnhanceFrame.Size = UDim2.new(1, 0, 0, 36)
EnhanceFrame.BackgroundTransparency = 1
EnhanceFrame.LayoutOrder = 3
EnhanceFrame.Parent = Content
local EnhanceToggle = Instance.new("TextButton")
EnhanceToggle.Size = UDim2.new(0, 140, 0, 32)
EnhanceToggle.Position = UDim2.new(0, 0, 0, 2)
EnhanceToggle.BackgroundColor3 = Color3.fromRGB(60, 40, 120)
EnhanceToggle.Text = "🧠 AI Enhance ON"
EnhanceToggle.TextColor3 = Color3.fromRGB(255, 255, 255)
EnhanceToggle.TextSize = 11
EnhanceToggle.Font = Enum.Font.GothamBold
EnhanceToggle.BorderSizePixel = 0
EnhanceToggle.Parent = EnhanceFrame
Instance.new("UICorner", EnhanceToggle).CornerRadius = UDim.new(0, 8)
local aiEnhanceEnabled = true
EnhanceToggle.MouseButton1Click:Connect(function()
aiEnhanceEnabled = not aiEnhanceEnabled
EnhanceToggle.BackgroundColor3 = aiEnhanceEnabled and Color3.fromRGB(60, 40, 120) or Color3.fromRGB(60, 60, 60)
EnhanceToggle.Text = aiEnhanceEnabled and "🧠 AI Enhance ON" or "📝 Raw Prompt"
end)
-- Auto-name toggle
local AutoNameToggle = Instance.new("TextButton")
AutoNameToggle.Size = UDim2.new(0, 130, 0, 32)
AutoNameToggle.Position = UDim2.new(0, 150, 0, 2)
AutoNameToggle.BackgroundColor3 = Color3.fromRGB(40, 100, 60)
AutoNameToggle.Text = "🏷️ AI Name ON"
AutoNameToggle.TextColor3 = Color3.fromRGB(255, 255, 255)
AutoNameToggle.TextSize = 11
AutoNameToggle.Font = Enum.Font.GothamBold
AutoNameToggle.BorderSizePixel = 0
AutoNameToggle.Parent = EnhanceFrame
Instance.new("UICorner", AutoNameToggle).CornerRadius = UDim.new(0, 8)
local autoNameEnabled = true
AutoNameToggle.MouseButton1Click:Connect(function()
autoNameEnabled = not autoNameEnabled
AutoNameToggle.BackgroundColor3 = autoNameEnabled and Color3.fromRGB(40, 100, 60) or Color3.fromRGB(60, 60, 60)
AutoNameToggle.Text = autoNameEnabled and "🏷️ AI Name ON" or "✏️ Custom Name"
end)
-- Custom Name Box (hidden by default)
local CustomNameBox = Instance.new("TextBox")
CustomNameBox.Size = UDim2.new(1, 0, 0, 36)
CustomNameBox.BackgroundColor3 = Color3.fromRGB(22, 20, 32)
CustomNameBox.TextColor3 = Color3.fromRGB(240, 230, 255)
CustomNameBox.PlaceholderText = "Custom tool name..."
CustomNameBox.PlaceholderColor3 = Color3.fromRGB(60, 50, 80)
CustomNameBox.Text = ""
CustomNameBox.TextSize = 13
CustomNameBox.Font = Enum.Font.Gotham
CustomNameBox.BorderSizePixel = 0
CustomNameBox.Visible = false
CustomNameBox.LayoutOrder = 4
CustomNameBox.Parent = Content
Instance.new("UICorner", CustomNameBox).CornerRadius = UDim.new(0, 8)
Instance.new("UIPadding", CustomNameBox).PaddingLeft = UDim.new(0, 12)
-- Generate Button
local GenerateBtn = Instance.new("TextButton")
GenerateBtn.Size = UDim2.new(1, 0, 0, 56)
GenerateBtn.BackgroundColor3 = Color3.fromRGB(120, 60, 255)
GenerateBtn.Text = "⚡ FORGE TOOL FROM PROMPT"
GenerateBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
GenerateBtn.TextSize = 16
GenerateBtn.Font = Enum.Font.GothamBold
GenerateBtn.BorderSizePixel = 0
GenerateBtn.LayoutOrder = 5
GenerateBtn.Parent = Content
Instance.new("UICorner", GenerateBtn).CornerRadius = UDim.new(0, 12)
local btnGrad = Instance.new("UIGradient")
btnGrad.Color = ColorSequence.new{
ColorSequenceKeypoint.new(0, Color3.fromRGB(120, 60, 255)),
ColorSequenceKeypoint.new(1, Color3.fromRGB(80, 30, 200)),
}
btnGrad.Parent = GenerateBtn
-- Status Area
local StatusFrame = Instance.new("Frame")
StatusFrame.Size = UDim2.new(1, 0, 0, 120)
StatusFrame.BackgroundColor3 = Color3.fromRGB(16, 14, 24)
StatusFrame.BorderSizePixel = 0
StatusFrame.Visible = false
StatusFrame.LayoutOrder = 6
StatusFrame.Parent = Content
Instance.new("UICorner", StatusFrame).CornerRadius = UDim.new(0, 10)
local StatusLabel = Instance.new("TextLabel")
StatusLabel.Size = UDim2.new(1, -16, 0, 24)
StatusLabel.Position = UDim2.new(0, 8, 0, 8)
StatusLabel.BackgroundTransparency = 1
StatusLabel.Text = "🤖 AI Processing..."
StatusLabel.TextColor3 = Color3.fromRGB(180, 160, 255)
StatusLabel.TextSize = 12
StatusLabel.Font = Enum.Font.GothamBold
StatusLabel.TextXAlignment = Enum.TextXAlignment.Left
StatusLabel.Parent = StatusFrame
local SubStatus = Instance.new("TextLabel")
SubStatus.Size = UDim2.new(1, -16, 0, 20)
SubStatus.Position = UDim2.new(0, 8, 0, 32)
SubStatus.BackgroundTransparency = 1
SubStatus.Text = ""
SubStatus.TextColor3 = Color3.fromRGB(120, 110, 150)
SubStatus.TextSize = 10
SubStatus.Font = Enum.Font.Gotham
SubStatus.TextXAlignment = Enum.TextXAlignment.Left
SubStatus.Parent = StatusFrame
local ProgressBg = Instance.new("Frame")
ProgressBg.Size = UDim2.new(1, -16, 0, 6)
ProgressBg.Position = UDim2.new(0, 8, 0, 60)
ProgressBg.BackgroundColor3 = Color3.fromRGB(38, 33, 52)
ProgressBg.BorderSizePixel = 0
ProgressBg.Parent = StatusFrame
Instance.new("UICorner", ProgressBg).CornerRadius = UDim.new(0, 3)
local ProgressFill = Instance.new("Frame")
ProgressFill.Size = UDim2.new(0, 0, 1, 0)
ProgressFill.BackgroundColor3 = Color3.fromRGB(140, 80, 255)
ProgressFill.BorderSizePixel = 0
ProgressFill.Parent = ProgressBg
Instance.new("UICorner", ProgressFill).CornerRadius = UDim.new(0, 3)
local StepLabel = Instance.new("TextLabel")
StepLabel.Size = UDim2.new(1, -16, 0, 20)
StepLabel.Position = UDim2.new(0, 8, 0, 74)
StepLabel.BackgroundTransparency = 1
StepLabel.Text = ""
StepLabel.TextColor3 = Color3.fromRGB(100, 200, 100)
StepLabel.TextSize = 10
StepLabel.Font = Enum.Font.GothamBold
StepLabel.TextXAlignment = Enum.TextXAlignment.Left
StepLabel.Parent = StatusFrame
-- AI Generated Info Display
local GeneratedInfo = Instance.new("TextLabel")
GeneratedInfo.Size = UDim2.new(1, 0, 0, 60)
GeneratedInfo.BackgroundTransparency = 1
GeneratedInfo.Text = ""
GeneratedInfo.TextColor3 = Color3.fromRGB(140, 200, 140)
GeneratedInfo.TextSize = 11
GeneratedInfo.Font = Enum.Font.Gotham
GeneratedInfo.TextXAlignment = Enum.TextXAlignment.Left
GeneratedInfo.TextWrapped = true
GeneratedInfo.Visible = false
GeneratedInfo.LayoutOrder = 7
GeneratedInfo.Parent = Content
-- Script Preview
local ScriptPreview = Instance.new("TextBox")
ScriptPreview.Size = UDim2.new(1, 0, 0, 100)
ScriptPreview.BackgroundColor3 = Color3.fromRGB(18, 18, 28)
ScriptPreview.TextColor3 = Color3.fromRGB(180, 255, 180)
ScriptPreview.PlaceholderText = "🤖 AI-generated script will appear here..."
ScriptPreview.PlaceholderColor3 = Color3.fromRGB(50, 50, 70)
ScriptPreview.Text = ""
ScriptPreview.TextSize = 10
ScriptPreview.Font = Enum.Font.Code
ScriptPreview.TextWrapped = true
ScriptPreview.TextXAlignment = Enum.TextXAlignment.Left
ScriptPreview.BorderSizePixel = 0
ScriptPreview.ClearTextOnFocus = false
ScriptPreview.Visible = false
ScriptPreview.LayoutOrder = 8
ScriptPreview.Parent = Content
Instance.new("UICorner", ScriptPreview).CornerRadius = UDim.new(0, 8)
Instance.new("UIPadding", ScriptPreview).PaddingLeft = UDim.new(0, 8)
Instance.new("UIPadding", ScriptPreview).PaddingTop = UDim.new(0, 8)
-- =====================================================================
-- STATUS HELPERS
-- =====================================================================
local function SetStatus(text, sub)
StatusFrame.Visible = true
StatusLabel.Text = text
SubStatus.Text = sub or ""
end
local function SetProgress(fraction)
TweenService:Create(ProgressFill, TweenInfo.new(0.3, Enum.EasingStyle.Quad), {
Size = UDim2.new(math.clamp(fraction, 0, 1), 0, 1, 0)
}):Play()
end
local function SetStep(text)
StepLabel.Text = text
end
-- =====================================================================
-- AI HORDE API FUNCTIONS
-- =====================================================================
local function HordeTextGenerate(prompt, maxLen)
maxLen = maxLen or 800
local payload = HttpService:JSONEncode({
prompt = prompt,
params = {
max_length = maxLen,
max_context_length = 2048,
temperature = 0.8,
},
models = {"Pygmalion-6B", "KoboldAI/OPT-2.7B-Nerys-Mix", "openrouter/google/gemma-7b-it:free"},
apikey = CONFIG.ANON_KEY
})
local responseBody = SafeHttpRequest("POST", CONFIG.HORDE_BASE .. "/v2/generate/text/async", payload)
if not responseBody then return nil end
local data = HttpService:JSONDecode(responseBody)
if not data.id then return nil end
local requestId = data.id
for i = 1, 45 do
task.wait(2)
local checkBody = SafeHttpRequest("GET", CONFIG.HORDE_BASE .. "/v2/generate/text/status/" .. requestId)
if checkBody then
local checkData = HttpService:JSONDecode(checkBody)
if checkData.done or checkData.faulted then break end
end
end
local finalBody = SafeHttpRequest("GET", CONFIG.HORDE_BASE .. "/v2/generate/text/status/" .. requestId)
if not finalBody then return nil end
local finalData = HttpService:JSONDecode(finalBody)
if finalData.generations and #finalData.generations > 0 then
local text = finalData.generations[1].text or ""
text = text:gsub("^%s*[\"']?", ""):gsub("[\"']?%s*$", "")
text = text:gsub("Here's[^\n]*\n?", "")
text = text:gsub("Here is[^\n]*\n?", "")
text = text:gsub("Certainly[!.,][^\n]*\n?", "")
text = text:gsub("Sure[!.,][^\n]*\n?", "")
text = text:gsub("```lua%s*", ""):gsub("```%s*", "")
return #text > 5 and text or nil
end
return nil
end
local function HordeImageGenerate(prompt)
local negative = "lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, cropped, worst quality, low quality, jpeg artifacts, watermark, username, blurry, deformed, nsfw"
local payload = HttpService:JSONEncode({
prompt = prompt,
negative_prompt = negative,
params = {
steps = CONFIG.STEPS,
width = CONFIG.IMAGE_WIDTH,
height = CONFIG.IMAGE_HEIGHT,
cfg_scale = CONFIG.CFG_SCALE,
sampler_name = "k_euler_a",
},
models = {CONFIG.DEFAULT_MODEL},
apikey = CONFIG.ANON_KEY,
nsfw = false,
})
local responseBody = SafeHttpRequest("POST", CONFIG.HORDE_BASE .. "/v2/generate/async", payload)
if not responseBody then return nil end
local data = HttpService:JSONDecode(responseBody)
if not data.id or data.is_possible == false then return nil end
local requestId = data.id
for i = 1, CONFIG.MAX_POLLS do
task.wait(CONFIG.POLL_INTERVAL)
SetProgress(0.3 + math.min(i / 35, 0.6))
local checkBody = SafeHttpRequest("GET", CONFIG.HORDE_BASE .. "/v2/generate/check/" .. requestId)
if checkBody then
local checkData = HttpService:JSONDecode(checkBody)
if checkData.done then break end
end
end
local finalBody = SafeHttpRequest("GET", CONFIG.HORDE_BASE .. "/v2/generate/status/" .. requestId)
if not finalBody then return nil end
local finalData = HttpService:JSONDecode(finalBody)
if finalData.generations and #finalData.generations > 0 then
return finalData.generations[1].img
end
return nil
end
-- =====================================================================
-- AI TOOL INFO GENERATOR (Name, Description, Type)
-- =====================================================================
local function GenerateToolInfo(userPrompt)
SetStatus("🧠 AI analyzing your prompt...", "Generating name, type, and description")
SetStep("Step 1/4: AI generating tool metadata...")
SetProgress(0.05)
local analysisPrompt = [[You are a game tool analyzer. Given a user's tool idea, output EXACTLY in this format with NO extra text:
NAME: [creative 1-3 word name]
TYPE: [Sword/Shield/Staff/Hammer/Bow/Dagger/Wand/Axe/Gun/Scythe]
DESC: [one sentence description]
EFFECTS: [3 keywords for visual effects]
User idea: ]] .. userPrompt .. "\n\nOutput:"
local response = HordeTextGenerate(analysisPrompt, 200)
if response then
local name = response:match("NAME:%s*(.-)%s*\n") or response:match("NAME:%s*(.-)%s*$") or "Mystic Tool"
local toolType = response:match("TYPE:%s*(.-)%s*\n") or response:match("TYPE:%s*(.-)%s*$") or "Sword"
local desc = response:match("DESC:%s*(.-)%s*\n") or response:match("DESC:%s*(.-)%s*$") or userPrompt
local effects = response:match("EFFECTS:%s*(.-)%s*\n") or response:match("EFFECTS:%s*(.-)%s*$") or "magic,glow,particles"
-- Clean up
name = name:gsub("[^%w%s%-]", ""):sub(1, 30)
desc = desc:sub(1, 100)
return name, toolType, desc, effects
end
-- Fallback
local words = {}
for word in userPrompt:gmatch("%S+") do
table.insert(words, word)
end
local fallbackName = (words[1] or "Mystic") .. " " .. (words[2] or "Tool")
return fallbackName:sub(1, 30), "Sword", userPrompt, "magic,glow"
end
-- =====================================================================
-- AI SCRIPT GENERATOR (FULL BEHAVIOR) - CRITICAL: LOCALSCRIPT FOR TOOLS
-- =====================================================================
local function GenerateFullScript(toolName, toolType, description, effects)
SetStatus("🤖 AI scripting your tool...", "Creating unique behavior")
SetStep("Step 2/4: AI writing LocalScript...")
SetProgress(0.15)
local scriptPrompt = string.format([[
You are an expert Roblox Lua scripter. Write a COMPLETE LocalScript for a Tool called "%s" (type: %s).
Description: %s
Visual effects: %s
CRITICAL REQUIREMENTS:
- This is a LOCALSCRIPT that goes inside a Tool
- Use: local tool = script.Parent
- Handle tool.Activated (when player clicks)
- Handle tool.Equipped and tool.Unequipped
- Use TweenService, Sound, ParticleEmitter, PointLight, Trail, Beam
- Create a UNIQUE special ability based on the description
- Use BodyVelocity/BodyForce for movement abilities
- Keep under 120 lines
- Output ONLY raw Lua code, no markdown, no explanations
Code:
]], toolName, toolType, description, effects)
local scriptCode = HordeTextGenerate(scriptPrompt, 1500)
if scriptCode and (scriptCode:find("local tool") or scriptCode:find("script%.Parent") or scriptCode:find("Tool")) then
return scriptCode
end
-- Fallback dynamic script
return string.format([[
local tool = script.Parent
local handle = tool:WaitForChild("Handle")
local TS = game:GetService("TweenService")
local UIS = game:GetService("UserInputService")
local debounce = false
local cooldown = 1.5
local lastUse = 0
-- Create effects
local function SetupEffects()
local light = Instance.new("PointLight")
light.Color = Color3.fromRGB(150, 100, 255)
light.Brightness = 2
light.Range = 8
light.Enabled = false
light.Parent = handle
local particles = Instance.new("ParticleEmitter")
particles.Texture = "rbxassetid://241685484"
particles.Color = ColorSequence.new(Color3.fromRGB(150, 100, 255), Color3.fromRGB(255, 200, 100))
particles.Size = NumberSequence.new(0.15, 0)
particles.Lifetime = NumberRange.new(0.3, 0.8)
particles.Rate = 20
particles.Speed = NumberRange.new(1, 3)
particles.SpreadAngle = Vector2.new(20, 20)
particles.Enabled = false
particles.Parent = handle
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://6895079853"
sound.Volume = 0.5
sound.Parent = handle
return light, particles, sound
end
local light, particles, sound = SetupEffects()
-- Special Ability: %s
local function SpecialAbility()
local char = tool.Parent
if not char then return end
local root = char:FindFirstChild("HumanoidRootPart")
if not root then return end
local hum = char:FindFirstChild("Humanoid")
-- Visual burst effect
local burst = Instance.new("Part")
burst.Anchored = true
burst.CanCollide = false
burst.Size = Vector3.new(4, 4, 4)
burst.Shape = Enum.PartType.Ball
burst.Material = Enum.Material.Neon
burst.Color = Color3.fromRGB(200, 150, 255)
burst.Transparency = 0.5
burst.CFrame = root.CFrame
burst.Parent = workspace
local tween = TS:Create(burst, TweenInfo.new(0.5), {
Size = Vector3.new(12, 12, 12),
Transparency = 1,
})
tween:Play()
tween.Completed:Connect(function() burst:Destroy() end)
-- Area damage
for _, v in pairs(workspace:GetPartBoundsInRadius(root.Position, 10)) do
local targetHum = v.Parent and v.Parent:FindFirstChild("Humanoid")
if targetHum and targetHum ~= hum then
targetHum:TakeDamage(25)
-- Knockback
local targetRoot = v.Parent:FindFirstChild("HumanoidRootPart")
if targetRoot then
local bv = Instance.new("BodyVelocity")
bv.Velocity = (targetRoot.Position - root.Position).Unit * 30 + Vector3.new(0, 10, 0)
bv.MaxForce = Vector3.new(10000, 10000, 10000)
bv.Parent = targetRoot
game:GetService("Debris"):AddItem(bv, 0.2)
end
end
end
sound:Play()
particles.Rate = 80
task.delay(0.3, function() if particles then particles.Rate = 20 end end)
-- Light flash
light.Brightness = 5
TS:Create(light, TweenInfo.new(0.3), {Brightness = 2}):Play()
end
tool.Equipped:Connect(function()
light.Enabled = true
particles.Enabled = true
end)
tool.Unequipped:Connect(function()
light.Enabled = false
particles.Enabled = false
end)
tool.Activated:Connect(function()
if debounce then return end
if tick() - lastUse < cooldown then return end
debounce = true
lastUse = tick()
SpecialAbility()
task.delay(cooldown, function() debounce = false end)
end)
]], description:sub(1, 50))
end
-- =====================================================================
-- GENERATION SERVICE (ROBLOX CUBE 3D AI)
-- =====================================================================
local function TryGenerationService(textPrompt)
if not GenerationService then return nil end
local success, result = pcall(function()
return GenerationService:GenerateModelAsync(
{
TextPrompt = textPrompt,
Size = CONFIG.CUBE3D_SIZE,
MaxTriangles = CONFIG.CUBE3D_TRI_MAX,
GenerateTextures = true,
},
{ PredefinedSchema = "Body1" },
nil
)
end)
if success and result and typeof(result) == "Instance" then
return result
end
return nil
end
-- =====================================================================
-- TOOL ASSEMBLY WITH PROPER SCRIPT INJECTION
-- =====================================================================
local function BuildTool(toolName, toolType, description, meshModel, texturePath, scriptCode)
local tool = Instance.new("Tool")
tool.Name = toolName
tool.RequiresHandle = true
tool.CanBeDropped = true
tool.ToolTip = description
local handle = Instance.new("Part")
handle.Name = "Handle"
handle.Size = Vector3.new(1, 1, 3)
handle.Material = Enum.Material.Neon
handle.BrickColor = BrickColor.new("Lavender")
handle.Parent = tool
-- Add mesh if available
if meshModel then
if meshModel:IsA("Model") then
local meshPart = meshModel:FindFirstChildWhichIsA("MeshPart") or meshModel:FindFirstChildWhichIsA("Part")
if meshPart then
handle:Destroy()
meshPart.Name = "Handle"
meshPart.Parent = tool
handle = meshPart
for _, child in pairs(meshModel:GetChildren()) do
if child ~= meshPart then
child.Parent = tool
end
end
end
elseif meshModel:IsA("BasePart") then
handle:Destroy()
meshModel.Name = "Handle"
meshModel.Parent = tool
handle = meshModel
end
elseif texturePath then
local ok, assetId = pcall(function() return getcustomasset(texturePath) end)
if ok and assetId then
for _, face in ipairs({"Front", "Back", "Left", "Right", "Top", "Bottom"}) do
local decal = Instance.new("Decal")
decal.Face = Enum.NormalId[face]
decal.Texture = assetId
decal.Parent = handle
end
end
end
handle.Anchored = false
handle.CanCollide = true
-- Add highlight
local highlight = Instance.new("Highlight")
highlight.FillColor = Color3.fromRGB(140, 100, 255)
highlight.OutlineColor = Color3.fromRGB(200, 160, 255)
highlight.FillTransparency = 0.8
highlight.Parent = handle
-- CRITICAL: Use LocalScript for tools to work client-side
local scriptInst = Instance.new("LocalScript")
scriptInst.Name = "ToolScript"
scriptInst.Source = scriptCode
scriptInst.Parent = tool
return tool
end
-- =====================================================================
-- MAIN GENERATION PIPELINE
-- =====================================================================
local isGenerating = false
local function OnGenerate()
if isGenerating then return end
local userPrompt = PromptBox.Text:match("^%s*(.-)%s*$") or ""
if #userPrompt < 3 then
SubStatus.Text = "Please enter a tool idea!"
PromptBox.BackgroundColor3 = Color3.fromRGB(60, 30, 30)
task.delay(1, function() PromptBox.BackgroundColor3 = Color3.fromRGB(22, 20, 32) end)
return
end
isGenerating = true
GenerateBtn.Text = "⚡ FORGING IN PROGRESS..."
GenerateBtn.BackgroundColor3 = Color3.fromRGB(80, 40, 150)
StatusFrame.Visible = true
GeneratedInfo.Visible = false
ScriptPreview.Visible = false
SetProgress(0)
local success, err = pcall(function()
-- Step 1: AI generates metadata
local toolName, toolType, description, effects
if autoNameEnabled or aiEnhanceEnabled then
toolName, toolType, description, effects = GenerateToolInfo(userPrompt)
else
toolName = CustomNameBox.Text:match("^%s*(.-)%s*$") or "Custom Tool"
if #toolName == 0 then toolName = "Mystic Tool" end
toolType = "Sword"
description = userPrompt
effects = "magic,glow"
end
SetStep("Step 2/4: AI writing script...")
SetProgress(0.1)
-- Show generated info
GeneratedInfo.Visible = true
GeneratedInfo.Text = string.format("📛 Name: %s\n🔧 Type: %s\n📝 %s", toolName, toolType, description)
-- Step 2: Generate script
local scriptCode = GenerateFullScript(toolName, toolType, description, effects)
if scriptCode then
ScriptPreview.Visible = true
ScriptPreview.Text = scriptCode
end
-- Step 3: Generate mesh/texture
SetStatus("🎨 Creating visual assets...", "Generating mesh/texture")
SetStep("Step 3/4: Generating 3D model/texture...")
SetProgress(0.25)
local meshModel = nil
local texturePath = nil
local meshMethod = "Procedural"
-- Try Cube3D first
meshModel = TryGenerationService(description .. ", " .. effects)
if meshModel then
meshMethod = "Cube3D"
SetStep("✓ Cube3D mesh generated!")
else
-- Try Horde image
SetStep("Trying AI texture generation...")
local imagePrompt = string.format("masterpiece, high quality 3D render, Roblox game asset, %s, %s, detailed textures, dramatic lighting, dark background", description, effects)
local enhancedPrompt = imagePrompt
if aiEnhanceEnabled then
local enhanced = HordeTextGenerate("Enhance this into a detailed image prompt for a 3D game weapon: " .. imagePrompt, 150)
if enhanced and #enhanced > 20 then
enhancedPrompt = enhanced
end
end
local imageUrl = HordeImageGenerate(enhancedPrompt)
if imageUrl then
meshMethod = "Horde Image"
SetStep("✓ AI texture generated!")
-- Save texture
local safeName = SanitizeFilename(toolName)
texturePath = DownloadPath(safeName)
pcall(function()
if not isfolder(CONFIG.SAVE_DIR) then makefolder(CONFIG.SAVE_DIR) end
local raw = game:HttpGet(imageUrl, false)
writefile(texturePath, raw)
end)
else
meshMethod = "Procedural"
SetStep("✓ Using procedural mesh")
end
end
SetProgress(0.6)
-- Step 4: Build and deploy tool
SetStatus("🔨 Assembling tool...", "Building final tool")
SetStep("Step 4/4: Building and deploying...")
local tool = BuildTool(toolName, toolType, description, meshModel, texturePath, scriptCode)
-- Add to backpack - THIS IS WHERE TOOLS GO
local backpack = Player:FindFirstChild("Backpack")
if backpack then
tool.Parent = backpack
else
-- Fallback to character if no backpack (shouldn't happen)
local character = Player.Character
if character then
tool.Parent = character
else
tool.Parent = workspace
end
end
SetProgress(1)
SetStatus("✅ Tool Forged Successfully!", string.format("%s | Method: %s", toolName, meshMethod))
SetStep("🎉 Check your backpack for: " .. toolName)
-- Reset button
GenerateBtn.Text = "✨ FORGE ANOTHER TOOL"
GenerateBtn.BackgroundColor3 = Color3.fromRGB(40, 140, 70)
task.delay(3, function()
GenerateBtn.BackgroundColor3 = Color3.fromRGB(120, 60, 255)
GenerateBtn.Text = "⚡ FORGE TOOL FROM PROMPT"
end)
end)
if not success then
SetStatus("❌ Error occurred", tostring(err))
SetStep("Check console for details")
GenerateBtn.Text = "🔄 TRY AGAIN"
GenerateBtn.BackgroundColor3 = Color3.fromRGB(140, 40, 40)
task.delay(3, function()
GenerateBtn.BackgroundColor3 = Color3.fromRGB(120, 60, 255)
GenerateBtn.Text = "⚡ FORGE TOOL FROM PROMPT"
end)
warn("Tool generation error: " .. tostring(err))
end
isGenerating = false
end
-- Connect events
GenerateBtn.MouseButton1Click:Connect(OnGenerate)
AutoNameToggle.MouseButton1Click:Connect(function()
CustomNameBox.Visible = not autoNameEnabled
end)
-- Toggle button
local ToggleBtn = Instance.new("TextButton")
ToggleBtn.Name = "TogglePromptForge"
ToggleBtn.Size = UDim2.new(0, 160, 0, 38)
ToggleBtn.Position = UDim2.new(0, 10, 0.5, -19)
ToggleBtn.BackgroundColor3 = Color3.fromRGB(100, 50, 220)
ToggleBtn.Text = "🤖 Prompt Forge"
ToggleBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
ToggleBtn.TextSize = 13
ToggleBtn.Font = Enum.Font.GothamBold
ToggleBtn.BorderSizePixel = 0
ToggleBtn.Parent = ScreenGui
Instance.new("UICorner", ToggleBtn).CornerRadius = UDim.new(0, 10)
local guiOpen = true
ToggleBtn.MouseButton1Click:Connect(function()
guiOpen = not guiOpen
MainFrame.Visible = guiOpen
ToggleBtn.Text = guiOpen and "▼ Hide Forge" or "🤖 Prompt Forge"
end)
-- Accent animation
task.spawn(function()
while ScreenGui and ScreenGui.Parent do
task.wait(2)
TweenService:Create(AccentLine, TweenInfo.new(1, Enum.EasingStyle.Quad), {
BackgroundColor3 = Color3.fromRGB(200, 120, 255)
}):Play()
task.wait(1.2)
TweenService:Create(AccentLine, TweenInfo.new(1, Enum.EasingStyle.Quad), {
BackgroundColor3 = Color3.fromRGB(140, 80, 255)
}):Play()
end
end)
print([[
═════════════════════════════════════════════════
🤖 AI PROMPT FORGE V3 - Loaded!
═════════════════════════════════════════════════
Type ANY idea - AI creates the ENTIRE tool!
- Generates: Name, Type, Description, Script, Mesh
- Tools actually WORK with proper LocalScript injection!
═════════════════════════════════════════════════
]])



ok now this is actually kinda sick tho
@bloxbochs ty
Yo i have an question, Can i steal the idea and try to make it better? Only if you allow it. I do love the script tho but it doesn't work exactly as i want. I'll do it if it is only alr with you. I'll also give you credit for it.
@ermwhatesigma420 sure its open-source
@Smg44463 Alr thanks
Yo this looks sick, Also Thx for the follow!!.
@MemeReview np