|
| 07 Jan 2014 05:08 PM |
I have been trying to change a textbutton's color but this script doesn't work:
function onDown() script.Parent.BackgroundColor3=Color3.new(88, 88, 88) end script.Parent.MouseButton1Down:connect(onDown)
function onUp() script.Parent.BackgroundColor3=Color3.new(47, 47, 47) end script.Parent.MouseButton1Up:connect(onUp) |
|
|
| Report Abuse |
|
|
|
| 07 Jan 2014 05:10 PM |
make it :
function MB1D() script.Parent.BackgroundColor3=Color3.new(88, 88, 88) end script.Parent.MouseButton1Down:connect(MB1D)
function MB2D() script.Parent.BackgroundColor3=Color3.new(47, 47, 47) end script.Parent.MouseButton2Down:connect(MB2D) |
|
|
| Report Abuse |
|
|
DataStore
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 8540 |
|
|
| 07 Jan 2014 05:23 PM |
@Mc, "Wouldn't work as expected, but that's cool!"
@OP, A Color3 value is between 0 and 1, not 0 and 255. Basically,
Color3.new(88/255, 88/255, 88/255)
Color3.new(47/255, 47/255, 47/255)
That's the only issue I can see. |
|
|
| Report Abuse |
|
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 07 Jan 2014 05:27 PM |
Or, more preferably:
local q, t = 88/255, 47/255 function colorToggle(x) return (function() script.Parent.BackgroundColor3 = Color3.new(x, x, x) end) end
script.Parent.MouseButton1Down:connect(colorToggle(q)) script.Parent.MouseButton1Up:connect(colorToggle(t)) |
|
|
| Report Abuse |
|
|
| |
|