wait(.03) local enabled = true Player = game.Players.LocalPlayer xbc = script.Parent control = Player.Backpack.Controls xbc.MouseButton1Down:connect(function(Play) if control.Disabled ~= true then control.Disabled = false else control.Disabled = true end end)
How do I make it to where if you click it again it does Disabled = true?
We can achieve this by an if statement.
An example of an if statement would be:
x = 1 if x == 1 then print("This would print") else print("This wouldn't, since x is 1.") end
This if statement would have the output of:
This would print
x = 2 -- Change it, and see what happens. if x == 1 then print("This would print") else print("This wouldn't, since x is 1.") end
Now our output would be:
This wouldn't, since x is 1
You try to use if's, and update with your new code. Try to apply it yourself.
Just do control.Disabled = not control.Disabled
This is a way to toggle a Boolean value.
wait(.03) local enabled = true Player = game.Players.LocalPlayer xbc = script.Parent control = Player.Backpack.Controls xbc.MouseButton1Down:connect(function() -- Remove the "Play" argument. The MouseButton1Down event only passes the X and Y coordinates of the mouse when clicked. If you want to use these, go ahead an re-add them. control.Disabled = not control.Disabled end)