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

Modifying this Color Changer from Brickcolor to Color3?

Asked by 4 years ago
Edited 4 years ago

So, I made this special door that changes the color of bricks if they have a certain name. It modifies different parts of a morph's model based on what their name is.

However, I noticed that it has a certain limitation. It can only change colors that Roblox made as part of Roblox's BrickColor system. I need a version of it that can change bricks to custom colors using the Color3 system.

If I copy and pasted the script parts here, it's a bit complicated for me to explain because it has scripts stored in a few parts. So, here's a link to the actual model for clarity.

https://www.roblox.com/library/4704984471/Shush

The model looks like a door with a panel next to it that looks like a series of colored buttons. By clicking the door and then clicking the buttons, the color of the door changes to the color of the button. Then when you walk through the door, if the morph you are wearing is named a certain word, it turns to the color of the door. You can change the special word to anything.

In each of the buttons is a script and a ClickDetector that changes the door's color to the name of the button. For instance, if a button is labeled "Bright red" and is clicked, the door changes to the Brickcolor Bright red. I'm having issues with trying to get the script to change the color of the door to a custom Color3 color.

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

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

In the big door piece labeled "Torso" are two scripts. One of them is where the keyword can be changed and handles the "change to this color upon contact" deal. The example keyword is "Special." It finds the color of the door itself and then changes the bricks named "Special" to its color. I can't find out how to get it to change bricks to its Color3 code instead of its BrickColor.

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)

I have no idea how Color3 works in code, so any help editing the script to work with Color3 would be massively helpful. Thanks in advance to anyone who knows how to fix it!

0
BrickColor.new(r,g,b) is an option. in terms of Color3 though, Color3.new(1,1,1) can only take values from 0 to 1. But, if you do Color3.fromRBG(r,g,b) it can take values from 0-255. hope this helps alivemaeonman 14 — 4y
0
BaseParts have a Color3 property hiimgoodpack 2009 — 4y

Answer this question