getscreensize
Returns the current camera viewport size.
Syntax
getscreensize() -> Vector2
Parameters
This function takes no parameters.
Returns
| Type | Description |
|---|---|
Vector2 | Viewport width and height in client-space pixels. |
Description
The size is read from the current camera. If no camera is available, the function returns Vector2(0, 0).
Example
local size = getscreensize()
print(size.X, size.Y)
Notes
- The value follows the Roblox window size.
- For UI scaling, combine it with
worldtoscreen.