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

Help changing decal color using Color3?

I want to be able to change the color of a decal to whatever I choose (preferably using the RGB 0-255 scale) But whenever I try, it just makes he decal black. My method seems to be incorrect, what am I doing wrong? For this script, I just want it to turn a bright red.

playerman = script.Parent.Parent.Parent.Parent.Parent.Character

function changecolor()
	playerman.HeadPart.Hair.Decal.Color3 = Color3.new("255,0,0")
	wait()
end

script.Parent.MouseButton1Click:connect(changecolor)

1 answer

✓ Accepted answer

A color3 value does not take a string, it takes 3 colours. So for you, it would be,

playerman = script.Parent.Parent.Parent.Parent.Parent.Character

function changecolor()
    playerman.HeadPart.Hair.Decal.Color3 = Color3.fromRGB(255,0,0) --You had it as a string.
    wait()
end

script.Parent.MouseButton1Click:connect(changecolor)

Adding onto what OldPalHappy stated.

local playerman = script.Parent.Parent.Parent.Parent.Parent.Character

function changecolor()
    playerman.HeadPart.Hair.Decal.Color3 = Color3.fromRGB(255,0,0)
    wait()
end

script.Parent.MouseButton1Click:Connect(changecolor)

2 comments

0

Ooh, I see. It works now thank you very much!

0

(Worth noting it's better to use local functions, just like it is with Local Variables, and :connect is deprecated in favor of :Connect)

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