When I click a textbutton draggable goes true on the frame. I want to make it when I click it again, all those trues turn to false.
script.Parent.MouseButton1Down:connect(function() script.Parent.Parent.Draggable = true script.Parent.Parent.Active = true end)
To switch between Draggable or not we can use If
statement andelse
.
script.Parent.MouseButton1Down:connect(function()--Function Listen for the MouseButton1Down Event. if script.Parent.Parent.Draggable == false then--Check If the Draggable Property is false, if It is then. print(script.Parent.Parent.Draggable) script.Parent.Parent.Draggable = true--Turn Its True else--If it wasn't Draggable property wasn't false then print(script.Parent.Parent.Draggable) script.Parent.Parent.Draggable = false--Turn it false. script.Parent.Parent.Active = true end end)
As for switching between Draggable
and not, we can simply use the 'not' thingy.
So to fix your code, you simply need it to look like this.
script.Parent.MouseButton1Down:connect(function() script.Parent.Parent.Draggable = not script.Parent.Parent.Draggable --If it's true, it switches to false, if false, it switches to true. script.Parent.Parent.Active = script.Parent.Parent.Draggable end)
So anyways, your code should work now. If you have any further problems/questions, please leave a comment below. Hope I helped :P