Run multiline Script in Studio edit mode (no Run or Play)

Studio allows running a single line of Lua that can permanently update object properties in editing mode. This allows for precise and calculated values for object properties, including Part.Position or CFrame.

Example moving a Dummy Rig by single line Lua instead:

workspace.model:SetPrimaryPartCFrame(CFrame.new(60, 3.195, 30))

… When using the Studio Move tool by hand is not accurate enough, or when property values could be better served by generative algorithms.

Can an entire Script be run in Studio in the same way, or is this what Studio Plugins are for?

2 Likes

Yes; the great thing about using lua is that code can be written on single lines.

For example:

if not started then return end

This logic is the exact same in the studio Command Bar, which allows whole scripts to be written in a single line. You can write code straight in without adding new lines, or simply copy and paste an existing script into the bar.

4 Likes

Cool, thanks for speedy responses mario118118 and Kiriot22

You can also use semicolons to begin the next statement too instead of invisible new lines:

local part = Instance.new("Part") ; part.Name = "Navigator" ; part.Parent = workspace

This means you can type entire scripts into a single line and execute it there.

3 Likes

Or you can not have semicolons, although it’d look fairly ugly. New statements in Lua, unlike other languages, don’t require the semicolon’s presence to start a new statement but you can do it. It’d probably be better to do it for conventional reasons anyway.

2 Likes