Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

**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

✓ Accepted answer

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

7 comments

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!

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

0

I've edited my post above to show the script that should work now

0

Still not working ;/ This is right isn't it? http://oi57.tinypic.com/qq1pfs.jpg

0

The script above should work if you copy it exactly

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.

0

Perfect answer. Thank you! :)

This discussion is preserved as it was. New answers, comments, and votes are closed.