Convenient way to "reorganise" code?

Is there any way to “reorganise” a code? For example a messed up code:

function          test()
	print  ("yes")
	if true   then
		    print ("yes")
end
     end

this is all messed up, is there any way to reorganise it without needing to type every single line again?
What I want is for example changing it to this:

function test()
	print("yes")
	if true then
		print("yes")
	end
end

Thanks!

1 Like

Select the part of code you want to re-organize, right click>Format>Format Selection:
formatSelection

4 Likes

Roblox’s IDE automatically beautifies code whenever it is pasted into the script editor anyway.

You can then use regex to remove any blank lines/consecutive whitespace characters.

1 Like