lloyAlloy on GitHub
new
Docs

new

Updated
new Name(...)
new Name(...) { Field = value }

Constructs a value. new Name(...) calls the constructor a struct's impl wrote, new or New, or the new of a Roblox datatype, an Instance, or any class; braces after it set fields on the new value, one per line. The braces set Parent after every other field, in a statement or an expression, so an Instance enters the tree with its properties set. new Name { ... } is a struct's fields form, the only way to construct one that writes no constructor. A struct never constructs without new.

The word is also free as a name. new before a type name constructs; new(x), new.field, new = 1, and new "Part" read the Luau way, so a local named new may hold Instance.new.

A constructor chains. new Thing():method() and new Thing().field read the way (new Thing()):method() does.

For a Roblox datatype, an Instance, or a class, new Thing(...) emits Thing.new(...). The prefer_new lint reports Thing.new(...) on a capitalized type path, and alloy flux --fix writes new Thing(...).