Viewport and selection
viewportManage the 3D view and selection in Roblox Studio. Select instances, frame them with camera focus, control the camera directly, or raycast to find what occupies a space.
Instructions
Works with the 3D view and the Studio selection.
select sets, extends or shrinks what is highlighted in Studio. Select what you just built or changed — it shows the user the result, and puts the instance under Studio's own move and scale handles. studio_status reports the current selection; this sets it.
focus aims the Studio camera at an instance and frames it so the whole thing is on screen. This is what makes screenshot worth having: a picture of wherever the camera happened to be answers nothing, while a picture of the thing you just built answers 'does it look right', which no amount of reading properties can. Build, focus, screenshot.
The distance is computed from the subject's size and the camera's field of view, so a doorway and a whole map both arrive filling a similar share of the frame. from changes the angle you view it from, and padding how tightly it is framed.
camera sets or reads the camera directly, for shots framing cannot express — standing inside a room, or looking along a corridor.
raycast fires a ray through the world and reports the first thing it hits, with position, surface normal, distance and material. This answers 'what occupies this space', which the data model alone cannot: use it to find the ground under a spawn point, or check whether a gap is clear before placing something.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| at | No | focus only: look at this point instead of an instance, e.g. "0, 10, 0". | |
| op | Yes | 'focus' points the camera at something and frames it, 'camera' sets it explicitly, 'select' changes the Studio selection, 'raycast' queries the world. | |
| from | No | focus only: direction to view from, e.g. "0, 1, 0" for directly above or "1, 0, 0" from the side. Defaults to a raised three-quarter view. | |
| mode | No | select only: replace the selection, extend it, or remove from it. | set |
| path | No | focus only: the instance to look at. A model, part, or folder containing them. | |
| paths | No | select only: instances to select. An empty array clears the selection. | |
| ignore | No | raycast only: instances the ray passes through. | |
| lookAt | No | camera only: the point to aim at. | |
| origin | No | raycast only: where the ray starts, e.g. "0, 50, 0". | |
| padding | No | focus only: how much room to leave around the subject. 1 is tight. | |
| position | No | camera only: where to put the camera, e.g. "0, 20, 30". | |
| studioId | No | Target Studio; omit for the active one. | |
| direction | No | raycast only: which way it points, e.g. "0, -1, 0" for straight down. | |
| fieldOfView | No | camera only: field of view in degrees. Lower is more zoomed in. | |
| maxDistance | No | raycast only: how far to look, in studs. |