Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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)

2 comments

0

don't forget to accept my answer if it helps.

0

sorry but it isnot working

1 answer

You are assigning the Value property to 255.

Remember that in multiple assignments, additional results will silently be discarded.

Take this snippet for example...

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:

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.

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

This discussion is preserved as it was. New answers, comments, and votes are closed.