pikaard
|
  |
| Joined: 14 Nov 2012 |
| Total Posts: 757 |
|
|
| 21 Aug 2013 11:57 PM |
I'm making a script, but, I want to make it like: One button turns on:
function onClicked() script.Parent.Value.Value = true end script.Parent.ClickDetector.MouseClick:connect(onClicked)
Then: One button turns off:
function onClicked() script.Parent.Value.Value = false end script.Parent.ClickDetector.MouseClick:connect(onClicked)
If it's true, it's on, if it's false, it's off, but I don't know how to make a script, like, I tried:
if script.Parent.Value.Value = true then (SCRIPT) end
But I know it's wrong, what do I do so it works? |
|
|
| Report Abuse |
|
|
pikaard
|
  |
| Joined: 14 Nov 2012 |
| Total Posts: 757 |
|
| |
|
Soquick
|
  |
| Joined: 01 Nov 2012 |
| Total Posts: 1497 |
|
|
| 22 Aug 2013 12:20 AM |
Make the if a function the one that checks if its true script.Parent.Parent.Value.Changed:connect(functionname) |
|
|
| Report Abuse |
|
|
pikaard
|
  |
| Joined: 14 Nov 2012 |
| Total Posts: 757 |
|
|
| 22 Aug 2013 12:23 AM |
So.. I just add:
script.Parent.Parent.Value.Changed:connect(functionname)
Hm? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 22 Aug 2013 12:26 AM |
| if value is not an object, then that won't work |
|
|
| Report Abuse |
|
|
Soquick
|
  |
| Joined: 01 Nov 2012 |
| Total Posts: 1497 |
|
|
| 22 Aug 2013 12:31 AM |
script.Parent.Parent.Value.Changed:connect(function() if script.Parent.Parent.Value.Value == true then Code end end) |
|
|
| Report Abuse |
|
|
pikaard
|
  |
| Joined: 14 Nov 2012 |
| Total Posts: 757 |
|
|
| 22 Aug 2013 12:32 AM |
| It's a BoolValue. If it's true, it's on, false is off. |
|
|
| Report Abuse |
|
|
|
| 22 Aug 2013 12:33 AM |
if Value == true then
OR
if Value then |
|
|
| Report Abuse |
|
|
pikaard
|
  |
| Joined: 14 Nov 2012 |
| Total Posts: 757 |
|
| |
|
Soquick
|
  |
| Joined: 01 Nov 2012 |
| Total Posts: 1497 |
|
|
| 22 Aug 2013 12:43 AM |
| Non it doesn't matter. I didn't want to change his code to much |
|
|
| Report Abuse |
|
|
pikaard
|
  |
| Joined: 14 Nov 2012 |
| Total Posts: 757 |
|
| |
|
Soquick
|
  |
| Joined: 01 Nov 2012 |
| Total Posts: 1497 |
|
| |
|
pikaard
|
  |
| Joined: 14 Nov 2012 |
| Total Posts: 757 |
|
| |
|
pikaard
|
  |
| Joined: 14 Nov 2012 |
| Total Posts: 757 |
|
|
| 22 Aug 2013 12:55 AM |
script.Parent.Parent.Value.Changed:connect(function() if script.Parent.Value.Value == true then while true do (SCRIPT) end while true do (SCRIPT) end end end) |
|
|
| Report Abuse |
|
|
Soquick
|
  |
| Joined: 01 Nov 2012 |
| Total Posts: 1497 |
|
|
| 22 Aug 2013 12:58 AM |
Change script.Parent.Parent.Value.Changed:connect() To script.Parent.Value.Changed:connect() |
|
|
| Report Abuse |
|
|
Soquick
|
  |
| Joined: 01 Nov 2012 |
| Total Posts: 1497 |
|
|
| 22 Aug 2013 12:59 AM |
| You need a while wait() do not while true do or will freeze game |
|
|
| Report Abuse |
|
|
pikaard
|
  |
| Joined: 14 Nov 2012 |
| Total Posts: 757 |
|
| |
|