BaconSoap
|
  |
| Joined: 12 Sep 2010 |
| Total Posts: 1882 |
|
|
| 10 Apr 2013 10:17 AM |
I'm trying to make a log become transparent when clicked, and if its already transparent, turn it back to 0 transparency.
Why does this work:
local loggy = game.Workspace.Log
function clickLoggy(playerWhoClicked) if loggy.Transparency == 0 then loggy.Transparency = 1 else loggy.Transparency = 0 end end script.Parent.ClickDetector.MouseClick:connect(clickLoggy)
And this doesn't:
local loggy = game.Workspace.Log
function clickLoggy(playerWhoClicked) if loggy.Transparency == 0 then loggy.Transparency = 0.5 else loggy.Transparency = 0 end end script.Parent.ClickDetector.MouseClick:connect(clickLoggy)
It's merely a change in the transparency value, why does it no longer work with this change? |
|
|
| Report Abuse |
|
|
getkoed2
|
  |
| Joined: 11 Apr 2010 |
| Total Posts: 1144 |
|
|
| 10 Apr 2013 10:20 AM |
| Idk, but please put 'then' on the same line as 'if' and you don't need playerWhoClicked. |
|
|
| Report Abuse |
|
|
BaconSoap
|
  |
| Joined: 12 Sep 2010 |
| Total Posts: 1882 |
|
|
| 10 Apr 2013 10:22 AM |
| Gee, thanks for the help. :L |
|
|
| Report Abuse |
|
|
getkoed2
|
  |
| Joined: 11 Apr 2010 |
| Total Posts: 1144 |
|
| |
|
BaconSoap
|
  |
| Joined: 12 Sep 2010 |
| Total Posts: 1882 |
|
| |
|
BaconSoap
|
  |
| Joined: 12 Sep 2010 |
| Total Posts: 1882 |
|
| |
|
|
| 10 Apr 2013 11:23 AM |
| Print the transparency at the start of your function. What does the output say? |
|
|
| Report Abuse |
|
|
BaconSoap
|
  |
| Joined: 12 Sep 2010 |
| Total Posts: 1882 |
|
| |
|
btft
|
  |
| Joined: 19 Feb 2011 |
| Total Posts: 1512 |
|
|
| 10 Apr 2013 11:27 AM |
function clickLoggy(playerWhoClicked) if loggy.Transparency == 0 then loggy.Transparency = 0.5 else loggy.Transparency = 0 end end script.Parent.ClickDetector.MouseClick:connect(playerWhoClicked) |
|
|
| Report Abuse |
|
|
blockold
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 1411 |
|
|
| 10 Apr 2013 11:30 AM |
To print it out? Do this: Also, I fixed up the if-then line ;3
local loggy = game.Workspace.Log
print(loggy.Transparency)
function clickLoggy(playerWhoClicked) if loggy.Transparency == 0 then loggy.Transparency = 1 else loggy.Transparency = 0 end end script.Parent.ClickDetector.MouseClick:connect(clickLoggy)
print(loggy.Transparency)
All that does is patch up the if-then statement and prints the transparency to the Output. To view the output, go into View - Output. It SHOULD work.
|
|
|
| Report Abuse |
|
|