Best way to use Roblox Command Bar with long lines of Code

Introduction

Hello Developers, If you have a problem and wanting to use long lines of code in the Command-Bar here is this tutorial to help you

What is Command-Bar

Its a Roblox Studio feature to run code live in the editing mode without running the test mode you can enable it from

View > Command-Bar

image

It usually show up at the bottom

image

How To Write Long Lines of Code

  • Create A Module Script Any Where You Like And Disable The Archivable Property

You Disable Archivable Property For The Module Script So When You Run Test The Game The Module Auto Remove it Self Avoiding Some Issues You Can Enable It If You Want To Use The Command Bar While Testing

image

image

  • You Can Type Any Code You Want In That Module Script For Example:
local module = {}

local OldPos = Vector3.new(0,0,0)

for i = 100, 1, -1 do
	local Part = Instance.new("Part",workspace)
	Part.Position = OldPos + Vector3.new(4,0,0)
	Part.Color = Color3.fromRGB(math.random(1,255),math.random(1,255),math.random(1,255))
	
	OldPos = Part.Position
end


return module
  • Go To The Command Bar And Write

image

require(game.ServerStorage.ModuleScript)--Your Module Script Directory Here
  • Press Enter on Your KeyBoard You Will Get A Message In The Out Put If And It Will Show Up Any Errors If There Is No Errors It Should Work Properly

Adding More Commands

Instead of making multiple Modules You Can Just Do Like This:

and in the Command-Bar Like This:

image

Result!

16 Likes

if you want single command in that modulrscript only, a better way to do it is

return function()
--go on, write your function
end
1 Like