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

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

Asked by 5 years ago

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)
0
Editted AltNature 169 — 5y
0
Remember this isn't a request site, Hopefully you learn from this solution AltNature 169 — 5y
0
I understand that's this is not a request site. Hopefully I'll become better at coding, thanks for your help. HimoutoUmaruDomaChan 20 — 5y

2 answers

Log in to vote
0
Answered by
AltNature 169
5 years ago
Edited 5 years ago

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)
1
Okay, except I want the color to change when someone touches it. HimoutoUmaruDomaChan 20 — 5y
0
Thank you for helping, works just fine now. HimoutoUmaruDomaChan 20 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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)
1
Doesn't seem to work. HimoutoUmaruDomaChan 20 — 5y
0
updated and works Gameplayer365247v2 1055 — 5y
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? HimoutoUmaruDomaChan 20 — 5y
0
Game player what your doing is okay, but can sometimes have you run into errors as such AltNature 169 — 5y
View all comments (7 more)
0
what numbers are u using in color3.new? Gameplayer365247v2 1055 — 5y
0
Do Color3.fromRGB() not Color3.new lol Mr_Unlucky 1085 — 5y
0
color3.new works just fine, i did it myself so dont lie Gameplayer365247v2 1055 — 5y
0
Alt answered my question now, so you don't have to worry about answering anymore. Thank you for the help though! HimoutoUmaruDomaChan 20 — 5y
0
ye np just like to help, u might use my answer sometime anyway Gameplayer365247v2 1055 — 5y
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. Mr_Unlucky 1085 — 5y
0
no color3.new has the numbers 0 to 255 but yes it got three parameters Gameplayer365247v2 1055 — 5y

Answer this question