|
| 06 Jan 2014 07:25 PM |
It is supposed to change the color of the textbutton when the cursor goes over it, but It isn't :/
--!
button = script.Parent
function onEnter() button.BackgroundColor3 = button.BackgroundColor3.new(255, 0, 4)
end
script.Parent.MouseEnter:connect(onEnter)
I get this error 20:24:42.020 - new is not a valid member |
|
|
| Report Abuse |
|
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 06 Jan 2014 07:26 PM |
| button.BackgroundColor3 = Color3.new(255, 0, 4) |
|
|
| Report Abuse |
|
|
|
| 06 Jan 2014 07:26 PM |
function onEnter() button.BackgroundColor3 = Color3.new(255/255, 0/255, 4/255)
end
script.Parent.MouseEnter:connect(onEnter) |
|
|
| Report Abuse |
|
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 06 Jan 2014 07:26 PM |
Sorry, I meant:
button.BackgroundColor3 = Color3.new(1, 0, 4/255) |
|
|
| Report Abuse |
|
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
| |
|
|
| 06 Jan 2014 07:28 PM |
| k. thx for replying so fast! |
|
|
| Report Abuse |
|
|
|
| 06 Jan 2014 07:32 PM |
| Okay, but now I need it to turn to white once the cursor goes OFF. Help? |
|
|
| Report Abuse |
|
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
| |
|
|
| 06 Jan 2014 07:34 PM |
| k thx. But I am still a noob, what are the color numbers to get back to white? |
|
|
| Report Abuse |
|
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 06 Jan 2014 07:35 PM |
| Same as it is in the GUI, except you divide by 255. So, in the properties interface, it says white is [255, 255, 255]. Color3, however, is not a value ranging from 0-255, but is in fact a float from 0-1. You therefore divide every value by 255 to get the desired Color3. It is [255/255, 255/255, 255/255], or [1, 1, 1]. |
|
|
| Report Abuse |
|
|
|
| 06 Jan 2014 07:37 PM |
ok, I put this script in, but this changes the color to black once the cursor leaves, I need white.
function onLeft() button.BackgroundColor3 = Color3.new(255, 255) end
script.Parent.MouseLeave:connect(onLeft) |
|
|
| Report Abuse |
|
|
| |
|
|
| 06 Jan 2014 07:38 PM |
| do you always divide by 255? or does it change? |
|
|
| Report Abuse |
|
|
|
| 06 Jan 2014 07:39 PM |
| or do you simply divide the number by itself? |
|
|
| Report Abuse |
|
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 06 Jan 2014 07:42 PM |
| No. If you divide it by itself, it would simply return 1; it's the same thing as x^0. You want to divide by 255 always. |
|
|
| Report Abuse |
|
|
| |
|