Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I try to change a brickcollorvalue with a script but i can't do it can someone help me?

Asked by 5 years ago

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)
0
don't forget to accept my answer if it helps. User#24403 69 — 5y
0
sorry but it isnot working kipwater -8 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

You are assigning the Value property to 255.

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);

Ad

Answer this question