robocu3
|
  |
| Joined: 13 Mar 2009 |
| Total Posts: 6485 |
|
|
| 05 Jul 2012 05:20 PM |
Hopefully that title got some people attention. lol Mmk, so I'm making a game called, "The mysterious cave" It's kinda a mystery thingy meant to be played on single player, so I thought maybe I could do something cool. Dunno what that had to do with it. Anyway, one part of the game includes you not being able to pass a room full of water that has an electric current running though it. The only way you can get past it is if you turn off the electricity. So if I made a generator sort thing, put an off button and put this script in it - -------------------------- function onClicked() wait(0.01) game.Workspace.Water.killscript.Disabled = true end game.Workspace.buttonname.onClicked:connect(onClicked) ------------------------------------------------------------------------- I probably made a mistake somewhere along the lines of this. I know this seems like something someone should have no problem with, but I don't know, I've always had serious trouble with the simplest on scripting. Any help would be appreciated. -=Robo=- |
|
|
| Report Abuse |
|
|
robocu3
|
  |
| Joined: 13 Mar 2009 |
| Total Posts: 6485 |
|
| |
|
WhiteRain
|
  |
| Joined: 24 Apr 2010 |
| Total Posts: 2723 |
|
|
| 05 Jul 2012 05:33 PM |
| I'm not sure if you can Enable/Disable scripts via Scripts. How about placing a value inside the water or whatever is supposed to kill you and then it changes until the button is pressed and it will only kill when the value is either true or false whichever you choose. |
|
|
| Report Abuse |
|
|
TwoBoo
|
  |
| Joined: 08 Feb 2011 |
| Total Posts: 10790 |
|
|
| 05 Jul 2012 05:33 PM |
function onClicked() wait(0.01) game.Workspace.Water.killscript.Disabled = true end game.Workspace.buttonname.ClickDetector.MouseClick:connect(onClicked) |
|
|
| Report Abuse |
|
|
TwoBoo
|
  |
| Joined: 08 Feb 2011 |
| Total Posts: 10790 |
|
| |
|
WhiteRain
|
  |
| Joined: 24 Apr 2010 |
| Total Posts: 2723 |
|
| |
|
robocu3
|
  |
| Joined: 13 Mar 2009 |
| Total Posts: 6485 |
|
|
| 05 Jul 2012 05:52 PM |
So, if I put this value into the water block and then redid the kill script to look like this... --------------------------
function onTouch(part) if game.Workspace.Water.tehvalue.Value = 1 then local humanoid = part.Parent:findFirstChild("Humanoid") if (humanoid ~=nil) then humanoid.Health = 0 else if end end
script.Parent.Touched:connect(onTouch) --------------------------- And along with that I changed the button script... --------------------------- function onClick(part) wait(0.01) game.Workspace.Water.tehvalue.Value = 1 end game.Workspace.buttonname.onClick:connect(onClick) --------------------------- Still not working. I don't understand. |
|
|
| Report Abuse |
|
|
robocu3
|
  |
| Joined: 13 Mar 2009 |
| Total Posts: 6485 |
|
| |
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 05 Jul 2012 06:05 PM |
idk if this is the problem but you have an unneeded else if, just make it
else end |
|
|
| Report Abuse |
|
|
johnhugh
|
  |
| Joined: 26 Mar 2009 |
| Total Posts: 1971 |
|
|
| 05 Jul 2012 06:07 PM |
| also, did you receive any output? |
|
|
| Report Abuse |
|
|
robocu3
|
  |
| Joined: 13 Mar 2009 |
| Total Posts: 6485 |
|
|
| 05 Jul 2012 06:15 PM |
Yeah, I did, it says - OnClicked is not a valid member of Part. -------------------- 17:50:35 - onClicked is not a valid member of Part 17:50:35 - Script "Workspace.buttonname.Script", Line 5 17:50:35 - stack end -------------------- See? -=Robo=- |
|
|
| Report Abuse |
|
|
robocu3
|
  |
| Joined: 13 Mar 2009 |
| Total Posts: 6485 |
|
|
| 05 Jul 2012 06:28 PM |
I came to the conclusion that the onclicked event isn't in the part, so I changed the event to game.Workspace.buttonname.ClickDetector:connect(OnClick) ----------------------------------------------------------------------- Doesn't work, still. Gotta different output. ----------------------------------------------------------------------- 18:25:02 - connect is not a valid member of ClickDetector 18:25:02 - Script "Workspace.buttonname.Script", Line 5 18:25:02 - stack end ----------------------------------------------------------------------- |
|
|
| Report Abuse |
|
|
robocu3
|
  |
| Joined: 13 Mar 2009 |
| Total Posts: 6485 |
|
|
| 05 Jul 2012 06:58 PM |
| WOW STILL NO REPLIES. AWESOME. |
|
|
| Report Abuse |
|
|
Biostream
|
  |
| Joined: 28 Mar 2011 |
| Total Posts: 913 |
|
|
| 05 Jul 2012 07:01 PM |
game.Workspace.buttonname.ClickDetector.onClick:connect(onClick) I think that's the proper event. |
|
|
| Report Abuse |
|
|
Biostream
|
  |
| Joined: 28 Mar 2011 |
| Total Posts: 913 |
|
|
| 05 Jul 2012 07:01 PM |
| *game.Workspace.buttonname.ClickDetector.MouseClick:connect(onClick) |
|
|
| Report Abuse |
|
|
WhiteRain
|
  |
| Joined: 24 Apr 2010 |
| Total Posts: 2723 |
|
| |
|
robocu3
|
  |
| Joined: 13 Mar 2009 |
| Total Posts: 6485 |
|
| |
|