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

Color3.new with RGB not working? [SOLVED]

Asked by
NotSoNorm 777 Moderation Voter
10 years ago

This little bit of code was to change the color when clicked, Whats wrong with it?

HomeB = script.Parent.HomeB
SettingsB = script.Parent.SettingsB
HomeB.MouseButton1Down:connect(function()
    HomeB.BackgroundColor3 = Color3.new(R/244, G/244, B/244)
    HomeB.TextColor3 = Color3.new(R/58, G/95, B/176)
end)

1 answer

Log in to vote
3
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
10 years ago

With your script, you're using RGB as variables. I think you want them to define a certain value for Color3. Color3 is already in RGB format, all you need to do is take the values, and divide them by 255. So it should be like the edited script below;

HomeB = script.Parent.HomeB
SettingsB = script.Parent.SettingsB
HomeB.MouseButton1Down:connect(function()
    HomeB.BackgroundColor3 = Color3.new(244/255, 244/255, 244/255)
    HomeB.TextColor3 = Color3.new(58/255, 95/255, 176/255)
end)
0
Wow! Thanks c: NotSoNorm 777 — 10y
Ad

Answer this question