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

Help with Draggable Gui?

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)

2 answers

✓ Accepted answer

To switch between Draggable or not we can use If statement and else.

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

####-Dyler3

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