|
| 01 Oct 2016 08:49 AM |
I'm a noob to scripting and I'm having my first goes. I'm trying to make a part (named PartG) change transparency when clicked (With a clickdetector named ClickG)
Here's the script: PartG = script.Parent
function turnGhostly() if PartG.Transparency == 1 then PartG.Transparency = 0 else PartG.Transparency = 1 end
PartG.ClickG.MouseClick:connect (turnGhostly)
What is incorrect? I would be glad if you told me! |
|
|
| Report Abuse |
|
|
|
| 01 Oct 2016 08:51 AM |
you are missing an "end"
the script analysis window as well as the output window would have caught this syntax error
please use them next time |
|
|
| Report Abuse |
|
|
|
| 01 Oct 2016 08:53 AM |
also, you might want to do something like
if PartG.Transparency >= 0.99 then
just to account for rounding issues |
|
|
| Report Abuse |
|
|
|
| 01 Oct 2016 08:53 AM |
@Agg Thank you. I opened the Output and fixed the problem. As I said, I'm new to this stuff. But it works now! I'll experiment with changing brick colors next. |
|
|
| Report Abuse |
|
|
|
| 01 Oct 2016 08:55 AM |
Can't really see what's wrong, but this is what I would usually do:
script.Parent.ClickDetector.MouseClick:connect(function() if script.Parent.Transparency == 1 then script.Parent.Transparency = 0 else script.Parent.Transparency = 1 end end
|
|
|
| Report Abuse |
|
|