Roblox Lua - Color3 预期,有字符串
local colorTable = {
('11, 13, 48'),
('35, 48, 48'),
('6, 47, 6'),
('91, 5, 7')
}
local value = math.random(1,#colorTable)
local picked_value = colorTable[value]
script.Parent.Background.BackgroundColor3 = picked_value
我的错误代码是 Color3预期,得到字符串
,有什么我可以解决这个问题吗?我的目标很简单,将特定颜色 RGB 随机化到框架背景。
local colorTable = {
('11, 13, 48'),
('35, 48, 48'),
('6, 47, 6'),
('91, 5, 7')
}
local value = math.random(1,#colorTable)
local picked_value = colorTable[value]
script.Parent.Background.BackgroundColor3 = picked_value
My error code was Color3 expected, got string
, is there anything I can fix this? My goal was simple, randomizing a specific color rgb to a frame backrgound.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
color3
可以通过color3.fromrgb
创建对象。A
Color3
object can be created byColor3.fromRGB
.