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

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

Asked by
Bulvyte 388 Moderation Voter
9 years ago

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

Log in to vote
1
Answered by 9 years ago

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)
0
Thank you! :) Bulvyte 388 — 9y
0
No problem. darkelementallord 686 — 9y
Ad

Answer this question