It is too hard to edit multiline code in the command bar

Posting on behalf of @Amritss

As a Roblox developer, it is currently too hard to add pieces of code to be executed in the command bar that span longer than just a line. The command bar is usually used to just add small bits of code before runtime. However, sometimes some developers like myself do need to use code that is longer than just one line.

For example, this is a snippet of code that grants a player’s DataStore key the premium currency. The code is only 16 lines long. But when pasted into the command bar, it can be confusing to read and hard to manage, and requires you to scroll side-to-side to view the rest of it. While you can use the Run Script function for stuff like this, it is not convenient because it requires a separate .txt or .lua file. It’s quicker just to put it in the command bar.

This also creates an issue where if you mistyped something in the command bar, or there was a syntax error, you would have to scroll in the command bar using the arrow keys or mouse clicking which is not easily done.

Suggestions

Option A: Roblox could add a similar system to the current script editor we have, but you can press a button to run the script in the current context

Option B: A multiline scrollbar

If this issue is addressed, it would improve my development experience because it would be much easier to locate syntax errors and typos, and improve general editing in the command bar.

17 Likes

Thanks, really wanted this feature to get added. Now let’s hope it does.

1 Like

For real, I want to make a plugin like InCommand from a while. A simple plugin like this but free could have such a positive influence on development. Hoping that one day a plugin like this will be available for everyone.

3 Likes

I rarely ever run snippets of code that are just 1 line in the command bar. The code I run I also usually type out by hand. Due to having to fit all the code on a single line it isn’t uncommon that I forget an end or a bracket here and there.

In the details below I’ve shared some of my most recent code snippets I used the command bar for. They are all multi-line snippets that could have benefited from a feature like this. I formatted them properly for this post to make the code actually readable.

click for code
-- this one was to preview VFX
local P = game.Selection:Get()
for i = 1, #P do
  P[i]:Emit(tonumber(P[i].Name))
end
-- this one was to check if RaycastParams are pass-by-value
local a = RaycastParams.new()
a.CollisionGroup = "DefaultOnly"
local b = a
b.CollisionGroup = "Default"
print(a.CollisionGroup)
-- this one was to test performance of value*value versus value^2
-- good luck trying to debug this one in the command bar
local value = 1.01
local t1 = 0
local t2 = 0
t1 = tick()
for i = 1, 100000 do
  value = value * value
end
t2 = tick() - t1
print(t2)
t1 = tick()
for j = 1, 100000 do
  value = value^2
end
t2 = tick() - t1
print(t2)
2 Likes

I have a discord channel full of multi-line command bar scripts. I frequently write mass-replace code which is multi-line. 99% of the time I use the command bar it is for a multi-line block of code.

There are currently plans to expand the command bar into a mini script editor, which I imagine would include this. However, there is no timeline available for when that may be!

we need this so badly; istg that I would pray to Big Brother Roblox if this feature were added

I’m a bit late to this conversation, but just wanted to inform you that a plugin like that but free already exists.