|
| 28 Jan 2014 02:11 PM |
I made a exoskeleton(morph) and I added a couple of GUI's to make it a bit more interactive. One of the GUI's are a "Helmet off" feature. When clicked, it's supposed to take away your helmet, and when you click "Helmet on", it is supposed to attach back onto you.
Here is the game if you want to test it out for yourself.
http://www.roblox.com/Remaking-all-42-Iron-Man-suits-place?id=142188733
The morph consists of two helmet parts. One that's visible all the time (unless clicked helmet off), and one is above your head that has "1" transparency. When clicked, it's supposed to create the illusion that your helmet has gone above your head so you can speak clearly. (the speaking part has nothing to do with it, it's just for RP purposes).
And here is the script to take the helmet off,
local player = script.Parent.Parent.Parent.Parent.Parent
function onClick(mouse)
player.Character.ATorso.Helmet.Transparency = 1 player.Character.ATorso.Helmet1.Transparency = 0
end
script.Parent.MouseButton1Down:connect(onClick)
And yes, I added one section called "Helmet" and one section called "Helmet1", so this SHOULD be working. But I have no idea why not. :c Thanks if you try helping. :) |
|
|
| Report Abuse |
|
|
Geomaster
|
  |
| Joined: 05 Jul 2008 |
| Total Posts: 1480 |
|
|
| 28 Jan 2014 02:13 PM |
Is this a gui? If it is, MouseButton1Down is a MOUSE event, not a Gui event
Try:
script.Parent.MouseButton1Click:connect(onClick) |
|
|
| Report Abuse |
|
|
|
| 28 Jan 2014 02:16 PM |
:0
I'm gonna give it a try. |
|
|
| Report Abuse |
|
|
crossbar
|
  |
| Joined: 08 Dec 2009 |
| Total Posts: 2817 |
|
|
| 28 Jan 2014 02:18 PM |
Please read on my GUI tutorial, it's really similar to this.
http://www.roblox.com/Forum/ShowPost.aspx?PostID=124293129
Also,
local player = script.Parent.Parent.Parent.Parent.Parent
function onClick(mouse)
player.Character.ATorso.Helmet.Transparency = 1 player.Character.ATorso.Helmet1.Transparency = 0
end
script.Parent.MouseButton1Down:connect(onClick)
"player.Character.ATorso.Helmet.Transparency = 1 player.Character.ATorso.Helmet1.Transparency = 0" That's your problem. Add in a few if statements! xD
hat = player.Character.ATorso.Helmet* Define this
if hat.Transparency == 1 then hat.Transparency = 0 else if hat.Transparency == 0 then hat.Transparency = 1 end end
Do something like that maybe? |
|
|
| Report Abuse |
|
|
Geomaster
|
  |
| Joined: 05 Jul 2008 |
| Total Posts: 1480 |
|
|
| 28 Jan 2014 02:20 PM |
| ^ His problem is that he's using an event that GUI's don't even have. |
|
|
| Report Abuse |
|
|
crossbar
|
  |
| Joined: 08 Dec 2009 |
| Total Posts: 2817 |
|
|
| 28 Jan 2014 02:21 PM |
"local player = script.Parent.Parent.Parent.Parent.Parent
function onClick(mouse)
player.Character.ATorso.Helmet.Transparency = 1 player.Character.ATorso.Helmet1.Transparency = 0
end"
Tell me that isn't a problem. And GUIs have MouseButton1Down.. |
|
|
| Report Abuse |
|
|
crossbar
|
  |
| Joined: 08 Dec 2009 |
| Total Posts: 2817 |
|
|
| 28 Jan 2014 02:22 PM |
| It might not be, but it's not the way I would do it to say fairly. xD |
|
|
| Report Abuse |
|
|
Geomaster
|
  |
| Joined: 05 Jul 2008 |
| Total Posts: 1480 |
|
|
| 28 Jan 2014 02:24 PM |
The tag is messy and the function is moot Either way, they're not causing his code to break
Also, the event you're referring to would go off if he clicked anywhere on the screen and just so happened to move his mouse on the button while clicking Don't think he wants that to happen |
|
|
| Report Abuse |
|
|
Joey370
|
  |
| Joined: 16 Dec 2012 |
| Total Posts: 71 |
|
|
| 28 Jan 2014 02:27 PM |
| ROBLOX studio is crap. Try local scripts. |
|
|
| Report Abuse |
|
|