A few days ago I made a custom built in to run elevated RSS code. With a bit of modification, I’m happy to announce to make this plugin open-source and free for anyone to use
https://www.roblox.com/library/5752890293/Legacy-Command-Utility
(This plugin will run at Identity Level 5, the identity level of any normal plugin)
Features
Full Custom loadstring based code execution
This plugin will allow you to run commands in the scope of our command bar, this is not sandboxed meaning you can modify the plugin itself (but I’m not holding any responsibility if you break the command bar)
Direct Integration into LogService
You could use this as a complete alternative to the Output Window.
Limitations
Code Execution can only be used in Edit mode due to loadstring restrictions.
This plugin was initially written to run elevated commands at identity level 6, so it’s pretty basic in most departments, however I may or may not be writing a much more advanced command utility in the near future
Enjoy!
Source Code
local TextService = game:GetService("TextService")
local LogService = game:GetService("LogService")
local HttpService = game:GetService("HttpService")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local Toolbar = plugin:CreateToolbar("Lua Command Bar")
local Button = Toolbar:CreateButton("Lua Command Bar", "Lua Command Bar", "rbxassetid://4811311133")
local Plugin = script.Parent
local Log = {}
local Gui = Plugin.Guis.Window
local OutputWindow = Gui.Contents
local CommandsExecuting = false
local DefaultColors = {
[Enum.MessageType.MessageOutput.Name] = Color3.new(1,1,1),
[Enum.MessageType.MessageInfo.Name] = Color3.new(0,0.5,1),
[Enum.MessageType.MessageWarning.Name] = Color3.new(1, 0.5, 0),
[Enum.MessageType.MessageError.Name] = Color3.new(1,0,0),
Unknown = Color3.new(1,1,1)
}
local Colors
local DockWidget = plugin:CreateDockWidgetPluginGui("ElevatedCommandBar", DockWidgetPluginGuiInfo.new(
Enum.InitialDockState.Bottom, -- Widget will be initialized in floating panel
false, -- Widget will be initially enabled
false, -- Don't override the previous enabled state
500, -- Default width of the floating window
250, -- Default height of the floating window
400, -- Minimum width of the floating window (optional)
250 -- Minimum height of the floating window (optional)
)
)
--Functions
local function SetColors()
Colors = plugin:GetSetting("ecb-OutputColors")
if Colors then
Colors = HttpService:JSONDecode(Colors)
else
Colors = {}
end
local newSet = false
for cName, cValue in pairs(DefaultColors) do
if not Colors[cName] then
Colors[cName] = cValue
newSet = true
end
end
if newSet then
plugin:SetSetting("ecb-OutputColors", HttpService:JSONEncode(Colors))
end
end
local function UpdateLog()
local AbsoluteFrameSize = OutputWindow.AbsoluteSize
for _, v in ipairs(Log) do
local FrameSize = TextService:GetTextSize(v.Label.Text, v.Label.TextSize, v.Label.Font, Vector2.new(AbsoluteFrameSize.X - 6, math.huge))
v.Label.Size = UDim2.new(0, FrameSize.X, 0, FrameSize.Y)
end
OutputWindow.CanvasSize = UDim2.new(0, OutputWindow.UIListLayout.AbsoluteContentSize.X - 6, 0, OutputWindow.UIListLayout.AbsoluteContentSize.Y + 3)
OutputWindow.CanvasPosition = Vector2.new(0, OutputWindow.CanvasSize.Y.Offset - OutputWindow.AbsoluteSize.Y)
end
local function CreateLog(text, eType)
local c = Colors[eType.Name] or Colors.Unknown
if eType == Enum.MessageType.MessageInfo or eType == Enum.MessageType.MessageWarning then
local t = os.date("*t")
local tFormat = string.format("%02d:%02d:%02d - ", t.hour, t.min, t.sec)
text = tFormat .. text
end
local OutputLog = Instance.new("TextLabel")
--Background
OutputLog.BackgroundTransparency = 1
OutputLog.Name = text
--Text
OutputLog.Text = text
OutputLog.TextColor3 = c
OutputLog.Font = "RobotoMono"
OutputLog.TextSize = 18
OutputLog.TextXAlignment = "Left"
OutputLog.TextYAlignment = "Top"
OutputLog.TextWrapped = true
local index = #Log + 1
OutputLog.LayoutOrder = index
OutputLog.Parent = OutputWindow
Log[index] = {Type = eType.Name, Label = OutputLog}
UpdateLog()
end
local function ClearLog()
for _, v in pairs(Log) do
v.Label:Destroy()
end
Log = {}
end
local function ldstr(text)
CreateLog("> " .. text, Enum.MessageType.MessageOutput)
local c, e = loadstring(text)
if c then
local s, e = pcall(c)
if not s then
CreateLog(e or "Error occurred, no output from Lua.", Enum.MessageType.MessageError)
end
else
CreateLog(e, Enum.MessageType.MessageError)
end
end
DockWidget.Title = "Legacy Command Utility"
Gui.Parent = DockWidget
Button.Click:Connect(function()
DockWidget.Enabled = not DockWidget.Enabled
Button:SetActive(DockWidget.Enabled)
end)
DockWidget:GetPropertyChangedSignal("AbsoluteSize"):Connect(UpdateLog)
Gui.CommandBar.CommandField.Command:GetPropertyChangedSignal("Text"):Connect(function()
local AbsoluteFrameSize = DockWidget.AbsoluteSize
local Text = Gui.CommandBar.CommandField.Command.Text
local TextSize = TextService:GetTextSize(Text, 14, Enum.Font.Ubuntu, Vector2.new(AbsoluteFrameSize.X - 8, math.huge))
local Y = TextSize.Y + 11
Gui.CommandBar.Size = UDim2.new(1,0,0,Y)
Gui.CommandBar.CommandField.Command.Size = UDim2.new(1,0,0,TextSize.Y)
Gui.Contents.Size = UDim2.new(1,0,1, -(Y+2))
end)
Gui.CommandBar.CommandField.Command.FocusLost:Connect(function(enterPressed)
if enterPressed then
if Gui.CommandBar.CommandField.Command.Text == "" then return end
ldstr(Gui.CommandBar.CommandField.Command.Text)
end
end)
plugin.Unloading:Connect(function()
ClearLog()
end)
Gui.CommandBar.CommandField.Visible = RunService:IsEdit()
Gui.CommandBar.CommandsDisabled.Visible = RunService:IsRunning()
SetColors()
LogService.MessageOut:Connect(CreateLog)
CreateLog("Legacy Command Utility - FilteredDev (" .. _VERSION .. ")", Enum.MessageType.MessageInfo)
CreateLog("This is the classic version of LegacyCommandUtility, a more advanced utility will replace this some time in the future.", Enum.MessageType.MessageInfo)
printidentity("Running at identity level")