IntConstrainedValue

Show Deprecated
Deprecated

An IntConstrainedValue is used to store a value which can never be less than MinValue and can never be more than MaxValue.

Summary

Properties

Events

Properties

ConstrainedValue

Hidden
Not Replicated
Read Parallel

Hold an Integer value between IntConstrainedValue.MinValue and IntConstrainedValue.MaxValue. Replaced by IntConstrainedValue.Value, but still functional.

MaxValue

Read Parallel

The highest number that the IntConstrainedValue.Value property can be.

MinValue

Read Parallel

The lowest number that the IntConstrainedValue.Value property can be.

Value

Not Replicated
Read Parallel

Used to hold an integer value between IntConstrainedValue.MinValue and IntConstrainedValue.MaxValue.

Methods

Events

Changed

Fired whenever the Value of the IntConstrainedValue is changed.

Parameters

value: number

Code Samples

The below example, assuming all referenced objects existed, would print the IntConstrainedValue's new value each time it's changed. In the example below it would print 2, assuming it's within IntConstrainedValue's MinValue and MaxValue range. Otherwise there will be no change.

IntConstrainedValue.Changed

local function valueChanged(newValue)
print(newValue)
end
workspace.IntConstrainedValue.Changed:Connect(valueChanged)
workspace.IntConstrainedValue.Value = 2