Color3Value

显示已弃用

*此内容使用人工智能(Beta)翻译,可能包含错误。若要查看英文页面,请点按 此处

一个容器对象 for a single Color3 值。

代码示例

This code sample sets the Value property of a Color3Value to Red.

Set Color3Value

local myColor3Value = script.Parent
myColor3Value.Value = Color3.new(1, 0, 0) -- Red
-- You can also store the color of a BrickColor value by accessing BrickColor's Color property, which is a Color3:
local someBrickColor = BrickColor.new("Really red")
myColor3Value.Value = someBrickColor.Color

属性

Value

读取并联

存储的 Color3

方法

活动

Changed

发射时,如果 Color3Value.ValueColor3Value 发生了变更,它将运行在新值被存储在参数对中,而不是在变更属性的字符对象。

这个事件,像其他更改的事件,可以用来跟踪颜色 3 值的更改时间和跟踪它可能更改的不同值。

例实例,这可能对于使用 Color3Values 追踪游戏中的颜色值,例如颜色为游戏使用可定制服装或物品的游戏来说是很有用的。

对于类似对象,例如 NumberValueStringValue,等级变更为适合需求的最佳对象类型。

参数

value: Color3

更改后的新值。


代码示例

The below example, assuming all referenced objects existed, would print the Color3Value's new value each time it changed. In the example below it would print "0.196078, 0.196078, 0.196078".

How to Use Color3Value.Changed

local value = Instance.new("Color3Value")
value.Parent = workspace
value.Changed:Connect(function(NewValue)
print(NewValue)
end)
value.Value = Color3.fromRGB(50, 50, 50)