IntConstrainedValue

顯示已棄用項目

*此內容是使用 AI(Beta 測試版)翻譯,可能含有錯誤。若要以英文檢視此頁面,請按一下這裡

已棄用

IntConstrainedValue 用於儲存不能少於 MinValue 且不能超過 MaxValue 的值。

概要

屬性

活動

屬性

ConstrainedValue

隱藏
未複製
平行讀取

保持 Integer 值在 IntConstrainedValue.MinValueIntConstrainedValue.MaxValue 之間,替換為 IntConstrainedValue.Value 但仍然功能完好。

MaxValue

平行讀取

IntConstrainedValue.Value 屬性最高可以達到的數字。

MinValue

平行讀取

IntConstrainedValue.Value 屬性可以達到的最低數值。

Value

未複製
平行讀取

用於在 IntConstrainedValue.MinValueIntConstrainedValue.MaxValue 之間保持整數值。

方法

活動

Changed

每當 IntConstrainedValue 的值變更時發射。

參數

value: number

範例程式碼

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