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

Refitting the script to work with Color3.FromRBG instead of Brickcolor?

Asked by 4 years ago

The other day I asked about modifying this set of scripts to work with Color3 values instead of Brickcolor values. People clarified that I could do Color3.FromRBG in order to use specific color3 color combinations, but it didn't work when I tried integrating it. Could somebody show me how that would work? Here are the two script parts that need the edit.

Here is a quick overview of the scripts' purposes. The full model they're in is designed to change the color of objects with a certain name. It looks like a door with a set of buttons next to it. By clicking the buttons, the color of the door changes. If a part is named a certain word and passes through the door, the part's color changes to the color of the door.

This script is the script where you click the buttons, the color of the door changes. The way it works is with a string and depending on the button's name, it changes the brickcolor of the door to that name of the button. For example, in this script, the button's name is "Bright red," so upon clicking it, the door's color changes to the Bright red Brickcolor. How would I set it up so that it changes the door to a Color3.FromRBG color? Ideally, the most easy way to do this would be to have the name of the button be the digits in the Color3.RBG value instead of the name of the brickcolor. When I tried setting it up, it didn't work, though.

function click()
    script.Parent.Parent:findFirstChild(tostring(_G.bp)).BrickColor = BrickColor.new(tostring(script.Parent.Name))
end

script.Parent.ClickDetector.MouseClick:connect(click)

This script is the script in the door itself. It looks for parts that make contact with it and if their name is the keyword, it changes their color to match the door's color. In this case, the keyword it's looking for is "Special". When I tried to have the door change the pieces labeled with the keyword to its color3 value, it didn't work. I'm sure I just didn't implement it correctly, but how that work?

incinerator = script.Parent

function onTouched(Special)
    if (Special.Name == "Special") then
        wait(0)
        Special.BrickColor = script.Parent.BrickColor
    end
end

connection = incinerator.Touched:connect(onTouched)

Sorry if this came off as rambling, but I really don't know how to update it to the way I need to. Even with the tips, I still don't know how to do this. Does anybody here know how to update it the way I need to?

0
Special.Color = script.Parent.Color Fifkee 2017 — 4y

Answer this question