Hello I'm Trying to change a brickcollorvalue with a script but i can't do it can someone help me?
function Click(mouse) script.Parent.Parent.Parent.Parent.Workspace.Garage.ColorB.Value = 255, 255, 0 end script.Parent.MouseButton1Down:connect(Click)
Remember that in multiple assignments, additional results will silently be discarded.
Take this snippet for example...
lua
local v1, v2 = 1;
print(v1, v2); --> 1 nil
v1
is assigned to 1
and v2
is just nil
.
Here is more what you were doing:
lua
local v1 = "First line.\nSecond line.", 13;
print(v1);
13
is silently discarded, and v1
is assigned to the string.
One of the Color3
constructors is Color3.fromRGB
which takes numbers ranging from 0-255
the Value
property of a Color3Value
expects a Color3
but you gave it a number
I'm going to assume script.Parent.Parent.Parent.Parent
is the DataModel
(game
). There's no need for such a monstrosity.
lua
--// Activated is recommended for listening for gui button clicks
script.Parent.Activated:Connect(function()
game.Workspace.Garage.ColorB.Value = Color3.fromRGB(255, 255, 0);
end);