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

Help with Name and BrickColor?

Asked by
Scootakip 299 Moderation Voter
8 years ago
wait(1)
for i,v in pairs(script.Parent:GetChildren()) do
    if v.ClassName == "TextButton" then
        v.MouseButton1Click:connect(function()
            script.Parent.Parent.Parent.Parent.Parent.Parent.DropColor.Value = v.Name
        end)
    end
end

I get an error that says that at line 5 it got a Name while it was expecting a BrickColor, however the Name is the name of a BrickColor... Is there anyway to convert it?

1 answer

Log in to vote
0
Answered by 8 years ago

You need to create a new brickcolor out of the name of the textbutton:

script.Parent.Parent.Parent.Parent.Parent.Parent.DropColor.Value = BrickColor.new(v.Name)
Ad

Answer this question