Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make it so that it will change a BoolValue to true if a button is pressed?

Asked by 9 years ago

**Hello fellow robloxians, Please can you answer this question? :)

How do I make it so that it will change a BoolValue to true if a button is pressed?

Thanks!

Best regards, Nathan.**

I had to choose 1 random tag since there was no "BoolValue"

1 answer

Log in to vote
-2
Answered by 9 years ago

What kind of button? I'll do GUI and physical:

EDITED: With the location of the value etc

BoolValue = script.Parent.Parent.Parent.Toggle
function onClick()
    if BoolValue.Value == false then
        BoolValue.Value = true
    else BoolValue.Value = false
    end
end

script.Parent.ClickDetector.MouseClick:connect(onClick)

Hope this helped, and I hope it worked :p

0
Okay, I tryed working it and I can't figure it out. I will post images to show what I am trying to do. http://oi61.tinypic.com/2j5nnn4.jpg -- Is that what I am trying to change? http://oi58.tinypic.com/a0gh8p.jpg -- That is my button. http://oi62.tinypic.com/wgt37n.jpg -- That is the BoolValue I am trying to change. Please reply asap :) Thanks! WelpNathan 307 — 9y
0
If the part with the script is in that model then BoolValue = script.Parent.Parent.Toggle. You don't need script.Parent.MouseButton1Click:connect(onClick) then either MasterDaniel 320 — 9y
0
I've edited my post above to show the script that should work now MasterDaniel 320 — 9y
0
Still not working ;/ This is right isn't it? http://oi57.tinypic.com/qq1pfs.jpg WelpNathan 307 — 9y
View all comments (3 more)
0
The script above should work if you copy it exactly MasterDaniel 320 — 9y
0
Please can you come on this? http://www.roblox.com/LavaBlast-Nuclear-Research-Facility-place?id=126056777. I will show you what I mean. WelpNathan 307 — 9y
0
Perfect answer. Thank you! :) WelpNathan 307 — 9y
Ad

Answer this question