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

Why doesn't the gui change colors ? And bug out ?

I made a script that onClick player clicks the gui, then the gui should change colors but when i checked it has 5100,5100,5100 black color heres the script: It just doesn't change to the wanted colors i chosen it changes to gray

function onClick()
	wait(.1)
	script.Parent.Parent.ImageColor3 = Color3.new(122, 36, 38)
	wait(.2)
	script.Parent.Parent.ImageColor3 = Color3.new(200, 59, 63)
end

script.Parent.MouseButton1Click:connect(onClick)

what is wrong ???

i tried with localscript and script, both didn't work and happened the same...

1 answer

✓ Accepted answer

When using Color3, it works on a range of 0-1, rather than the expected 0-255. What you need to do is divide the number by 255 so:

function onClick()
    wait(.1)
    script.Parent.Parent.ImageColor3 = Color3.new(122/255, 36/255, 38/255)
    wait(.2)
    script.Parent.Parent.ImageColor3 = Color3.new(200/255, 59/255, 63/255)
end

script.Parent.MouseButton1Click:connect(onClick)

2 comments

0

Thank you! :)

0

No problem.

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