-- not Client-Side Executor GUI local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local player = Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") -- Create the GUI local screenGui = Instance.new("ScreenGui") screenGui.Name = "LuaExecutor" screenGui.Parent = playerGui local frame = Instance.new("Frame") frame.Size = UDim2.new(0, 400, 0, 300) frame.Position = UDim2.new(0.5, -200, 0.5, -150) frame.AnchorPoint = Vector2.new(0.5, 0.5) frame.BackgroundColor3 = Color3.fromRGB(50, 205, 50) frame.BorderSizePixel = 0 frame.Active = true frame.Draggable = true frame.Selectable = true frame.Parent = screenGui -- Title bar with drag functionality local titleBar = Instance.new("Frame") titleBar.Size = UDim2.new(1, 0, 0, 30) titleBar.BackgroundColor3 = Color3.fromRGB(20, 20, 30) titleBar.BorderSizePixel = 0 titleBar.Parent = frame local title = Instance.new("TextLabel") title.Text = "NPC Lua Executor" title.Size = UDim2.new(1, 0, 1, 0) title.BackgroundTransparency = 1 title.TextColor3 = Color3.fromRGB(255, 255, 255) title.Font = Enum.Font.SourceSansBold title.Parent = titleBar -- Close button local closeButton = Instance.new("TextButton") closeButton.Text = "X" closeButton.Size = UDim2.new(0, 30, 1, 0) closeButton.Position = UDim2.new(1, -30, 0, 0) closeButton.BackgroundColor3 = Color3.fromRGB(200, 50, 50) closeButton.TextColor3 = Color3.fromRGB(255, 255, 255) closeButton.Parent = titleBar -- Main content local inputBox = Instance.new("TextBox") inputBox.PlaceholderText = "Enter Lua code here (/help for commands)" inputBox.Size = UDim2.new(1, -20, 0.6, -10) inputBox.Position = UDim2.new(0, 10, 0, 40) inputBox.BackgroundColor3 = Color3.fromRGB(40, 40, 50) inputBox.TextColor3 = Color3.fromRGB(255, 255, 255) inputBox.TextXAlignment = Enum.TextXAlignment.Left inputBox.TextYAlignment = Enum.TextYAlignment.Top inputBox.MultiLine = true inputBox.TextWrapped = true inputBox.ClearTextOnFocus = false inputBox.Parent = frame local buttonContainer = Instance.new("Frame") buttonContainer.Size = UDim2.new(1, -20, 0, 40) buttonContainer.Position = UDim2.new(0, 10, 0.65, 0) buttonContainer.BackgroundTransparency = 1 buttonContainer.Parent = frame local executeButton = Instance.new("TextButton") executeButton.Text = "Execute" executeButton.Size = UDim2.new(0.3, 0, 1, 0) executeButton.Position = UDim2.new(0, 0, 0, 0) executeButton.BackgroundColor3 = Color3.fromRGB(50, 150, 50) executeButton.TextColor3 = Color3.fromRGB(255, 255, 255) executeButton.Parent = buttonContainer local clearButton = Instance.new("TextButton") clearButton.Text = "Clear" clearButton.Size = UDim2.new(0.3, 0, 1, 0) clearButton.Position = UDim2.new(0.35, 0, 0, 0) clearButton.BackgroundColor3 = Color3.fromRGB(150, 50, 50) clearButton.TextColor3 = Color3.fromRGB(255, 255, 255) clearButton.Parent = buttonContainer local injectButton = Instance.new("TextButton") injectButton.Text = "Inject" injectButton.Size = UDim2.new(0.3, 0, 1, 0) injectButton.Position = UDim2.new(0.7, 0, 0, 0) injectButton.BackgroundColor3 = Color3.fromRGB(50, 50, 150) injectButton.TextColor3 = Color3.fromRGB(255, 255, 255) injectButton.Parent = buttonContainer local outputBox = Instance.new("ScrollingFrame") outputBox.Size = UDim2.new(1, -20, 0.25, -10) outputBox.Position = UDim2.new(0, 10, 0.75, 0) outputBox.BackgroundColor3 = Color3.fromRGB(40, 40, 50) outputBox.BorderSizePixel = 0 outputBox.ScrollBarThickness = 8 outputBox.Parent = frame local outputText = Instance.new("TextLabel") outputText.Text = "Output will appear here" outputText.Size = UDim2.new(1, 0, 1, 0) outputText.BackgroundTransparency = 1 outputText.TextColor3 = Color3.fromRGB(255, 255, 255) outputText.TextXAlignment = Enum.TextXAlignment.Left outputText.TextYAlignment = Enum.TextYAlignment.Top outputText.TextWrapped = true outputText.Parent = outputBox -- Drag functionality local dragging local dragInput local dragStart local startPos local function updateOutput(text) outputText.Text = text outputBox.CanvasSize = UDim2.new(0, 0, 0, outputText.TextBounds.Y + 10) outputBox.CanvasPosition = Vector2.new(0, outputText.TextBounds.Y) end local function onInputChanged(input) if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then local delta = input.Position - dragStart frame.Position = UDim2.new(0, startPos.X.Offset + delta.X, 0, startPos.Y.Offset + delta.Y) end end titleBar.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then dragging = true dragStart = input.Position startPos = frame.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end) titleBar.InputChanged:Connect(onInputChanged) -- Button functionality closeButton.MouseButton1Click:Connect(function() screenGui:Destroy() end) clearButton.MouseButton1Click:Connect(function() inputBox.Text = "" updateOutput("Output cleared") end) executeButton.MouseButton1Click:Connect(function() if inputBox.Text ~= "" then updateOutput("Executing...") -- Send to server for validation local success, result = pcall(function() return game:GetService("ReplicatedStorage"):WaitForChild("ExecutorRemote"):InvokeServer("execute", inputBox.Text) end) if success then updateOutput(tostring(result)) else updateOutput("Error: " .. tostring(result)) end end end) injectButton.MouseButton1Click:Connect(function() updateOutput("Injecting script...") -- Send to server for validation local success, result = pcall(function() return game:GetService("ReplicatedStorage"):WaitForChild("ExecutorRemote"):InvokeServer("inject", inputBox.Text) end) if success then updateOutput(tostring(result)) else updateOutput("Error: " .. tostring(result)) end end)