generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

TextButton Color Change

Previous Thread :: Next Thread 
Rocky28447 is online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
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
McChicken72 is not online. McChicken72
Joined: 09 Feb 2013
Total Posts: 1115
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 is not online. 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 is not online. 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
Rocky28447 is online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
08 Jan 2014 03:33 PM
Thanks! :D
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image