[Update] November 11, 2026
Hi Creators,
We’re launching a new Luau feature, if local and if const, as a Studio beta! This is new syntax that allows you to write:
if local character = player.Character then
if local humanoid = character:FindFirstChildWhichIsA("Humanoid") then
if local rootPart = humanoid.RootPart then
...
end
end
end
Instead of:
local character = player.Character
if character then
local humanoid = character:FindFirstChildWhichIsA("Humanoid")
if humanoid then
local rootPart = humanoid.RootPart
if rootPart then
...
end
end
end
You can learn more about this feature and the design behind it by reading the RFC.
Additional Details
Here are some more detailed examples
if const statements
if const player = Players:GetPlayerFromCharacter(character) then
print(player.Name)
end
if expressions
local name = if local player = Players:GetPlayerFromCharacter(character) then player.Name else "Unknown"
-- equivalently, with const:
local name = if const player = Players:GetPlayerFromCharacter(character) then player.Name else "Unknown"
type narrowing
local function findPlayer(): Player?
-- player: Player
print(player.Name)
end
if local player = findPlayer() then
-- player: Player
end
What’s not supported yet
For this Beta, if local supports a single name and a single value. Multi-return bindings like this are not allowed:
if local ok, result = pcall(riskyFunction) then
...
end
Neither are compound conditions like:
if local x = foo(); local y = bar() then
...
end
These may be supported in the future.
Try it out
You can enable this now under “If Local/Const Bindings” in Studio Beta Features. For more details, see the RFC.
Give it a try and let us know what you think!
Thank you!


