Skip to main content

SetValue

Safely sets a value for a state, then returns it.

TypeSinceScoped
Utility0.3.1No

Constructor

SetValue(Value : ValueObject, NewValue : any?)

Usage

SetValue is an alternative to setting Value.Value that returns the value you set. It also does not error if you try to set another userdata, but it will not change random userdata.

Below is an example usage:

local MyValue = Value(1000)

local NewValue = SetValue(1001) -- NewValue is 1001, and MyValue.Value is also equal to 1001