PHChamp
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 211 |
|
|
| 31 Jul 2016 01:27 PM |
I would like to change the background tranceparency of a background when it is clicked, then change it back again when it is released. The transparency gets changed when I click, but when I release it stays the same. How would I fix this.
function MouseDown (Gui) Gui.BackgroundTransparency = 0 while Gui.Button1Down do return end Gui.BackgroundTransparency = 1 end
C_2.MouseButton1Down:connect(function() MouseDown(C_2) end) |
|
|
| Report Abuse |
|
|
PHChamp
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 211 |
|
| |
|
|
| 31 Jul 2016 03:42 PM |
MouseButton1Click
MouseButton1Up
bind these to functions |
|
|
| Report Abuse |
|
|
PHChamp
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 211 |
|
| |
|
|
| 31 Jul 2016 04:00 PM |
Use MouseEnter and MouseLeave instead. http://wiki.roblox.com/index.php?title=API:Class/GuiObject/MouseEnter http://wiki.roblox.com/index.php?title=API:Class/GuiObject/MouseLeave |
|
|
| Report Abuse |
|
|
PHChamp
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 211 |
|
|
| 31 Jul 2016 04:06 PM |
It still doesnt work. I click it and it doesnt change when I let go
function MouseDown (Gui) Gui.BackgroundTransparency = 0 while Gui.MouseButton1Up do return end Gui.BackgroundTransparency = 1 end
C_2.MouseButton1Click:connect(function()CFrontUpdateVal() PlayerColor() MouseDown(C_2) end) |
|
|
| Report Abuse |
|
|
PHChamp
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 211 |
|
| |
|
PHChamp
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 211 |
|
| |
|
|
| 31 Jul 2016 04:30 PM |
Dude just use Click and Up
click will fire when you click
up will fire when you stop clicking
just bind 2 events |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 31 Jul 2016 04:38 PM |
local gui = script.Parent
gui.MouseButton1Down:connect(function() gui.BackgroundTransparency = 0 end)
gui.MouseButton1Up:connect(function() gui.BackgroundTransparency = 1 end)
|
|
|
| Report Abuse |
|
|
PHChamp
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 211 |
|
| |
|