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

I keep getting a error saying it should be Color3 but, its a brickcolor?

Asked by 9 years ago

(Tittle explains most) Its a textbutton, which has a BrickColorValue in it, named Color and a script in it. The error says: bad argument #1 to 'new' (Color3 expected, got userdata)

There's bricks in workspace named "Lego Brick" with a bool value inside of them, the script that generates them sets the bool value to true.

The script is:

script.Parent.MouseButton1Click:connect(function()
    local color = script.Parent.Color
    local brick = game.Workspace:GetChildren()
    for i,v in pairs(brick) do
        if v.Name == "Lego Brick" then
            if v.ScriptGeneratedBrick.Value == true then
                v.BrickColor = BrickColor.new(color.Value)
            end
        end
    end
end)
  • Line 7 is where i get the error -

1 answer

Log in to vote
3
Answered by 9 years ago

You don't need to create a new BrickColor with color.Value. It is already a brickcolor

 v.BrickColor = color.Value
1
Thx! It worked! Operation_Meme 890 — 9y
Ad

Answer this question