Proton Values
A Value object is a sort of storage container for a variable. Values allow you to restrict types and lock the value from being changed.
Values are created using the value.new() function. Values are read with the :get() method and updated with the :set() method.
Increment
Values can be incremented by calling :increment(). This has the expected result for all Roblox engine data types.
Type restriction
You can optionally restrict the type by passing the type name as the second parameter.
As you can see in the above example, attempting to set a restricted type to a value of a different type will print a warning without ending the thread.
Valid type names
The type name should be the result of the typeof() function. For instance, since typeof(15) returns number, the type name is also "number".
Locking
You can lock a value (disable the value from being updated by any script) by calling :lock(). You can unlock it with :unlock().
Attempting to update a locked value will print a warning without ending the thread.
Naming
You can opt to give a value a name by including the name as the third parameter to value.new(). This will help you identify values in error messages, aiding you track down the root cause of potential errors. This has no effect outside of error logging.