Use any ROBLOX method with nullable parameters or create your own function with nullable parameters:
local function Add(a: number, b: number?): number
return a + (b or a)
end
Using pcall to execute the function:
pcall(Add, 1)
not providing the b parameter will result in a type error:
In order to avoid the type error, a nil value has to be passed:
pcall(Add, 1, nil)
![]()
Expected behavior
Nullable parameters are optional and should be detected as optional.
Not providing an optional parameter should not cause a type error.
