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

Help changing decal color using Color3?

Asked by
snarns 25
7 years ago

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

Log in to vote
1
Answered by 7 years ago
Edited 7 years ago

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)
0
Ooh, I see. It works now thank you very much! snarns 25 — 7y
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) OldPalHappy 1477 — 7y
Ad

Answer this question