Hello DevForum!
I have recently been creating a plugin that acts like a console for roblox studio.
Example image below if your confused
I am working on the good o’ll cd
command, or change directory
. I want the console to be able to change its ‘location’, for when I add removing (rm
) and listing (ls
), etc.
What I am stumped on how to do is go from the string, args[2]
to finding if it’s an actual path location (Like game.Workspace
or game.StarterGui.SomeGuiName
), and after that to edit the name of a certain text label to change accordingly to the new location.
Here is my code currently :
Module Script located in a commands folder
--|| VARS ||--
local command = {}
--|| MAIN ||--
command.Execute = function(args, consoleUI)
local function newLine()
local textPrmpt = consoleUI.Assets.TextPrompter:Clone()
consoleUI.Assets.TextPrompter.TextMain.TextEditable = false
consoleUI.Assets.TextPrompter.Name = "OldPrompt"
textPrmpt.Parent = consoleUI.Assets
textPrmpt.Name = "TextPrompter"
textPrmpt.TextMain.Text = ""
textPrmpt.TextMain.PlaceholderText = " "
end
if args[2] == nil then
local newResponse = script.Parent.Assets:WaitForChild("Response"):Clone()
if consoleUI.Assets:FindFirstChild("Response") then
consoleUI.Assets.Response.Name = "OldResponse"
end
newResponse.Parent = consoleUI.Assets
newResponse.TextColor3 = Color3.new(0.929992, 0.718502, 0.698558)
newResponse.Name = "Response"
newResponse.Text = "ERR: please reference a directory/object"
newLine()
return
end
-- Here is where I can use args[2] to figure out if the directory/object exists and how to fetch the name of the directory/object
newLine()
end
return command
If you have any ideas on how to achieve this, they would be greatly appreciated!
Thanks a lot in advance
!
