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

My script will only allow me to change a part's color into a basic one, could someone help?

I need to make a script that will allow me to change a part's color to a specific color in the color wheel, (for example, moss) But either I am doing something wrong or the script won't let me use those kinds of colors.

The script I am using:

script.Parent.Touched:connect(function(hit)
script.Parent.BrickColor = BrickColor.Red() -- I can only use basic colors
end)

3 comments

0

Editted

0

Remember this isn't a request site, Hopefully you learn from this solution

0

I understand that's this is not a request site. Hopefully I'll become better at coding, thanks for your help.

2 answers

✓ Accepted answer

In order for you to use the color moss, you must use BrickColor.New("Moss") as Red works since it is a primary color

local part = game.Workspace.Part

wait(2)
part.BrickColor = BrickColor.New("Moss")

with your script,

local part = script.Parent

part.Touched:Connect(function()
 part.BrickColor = BrickColor.New("Moss")
 end)

2 comments

1

Okay, except I want the color to change when someone touches it.

0

Thank you for helping, works just fine now.

instead do

script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
script.Parent.BrickColor = Vector3.new(numbers in here)-- this will allow u do any color combination there is
end
end)

11 comments

1

Doesn't seem to work.

0

updated and works

1

Hm, there's a bug happening for some reason. So I'm trying to make it red, but the color keeps turning black. What can I do to fix this?

0

Game player what your doing is okay, but can sometimes have you run into errors as such

0

what numbers are u using in color3.new?

0

Do Color3.fromRGB() not Color3.new lol

0

color3.new works just fine, i did it myself so dont lie

0

Alt answered my question now, so you don't have to worry about answering anymore. Thank you for the help though!

0

ye np just like to help, u might use my answer sometime anyway

0

according to https://roblox.fandom.com/wiki/Tutorial:Using_Color3 doing Color3.new() has three parameters and those parameters can only be between zero and one.

0

no color3.new has the numbers 0 to 255 but yes it got three parameters

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