Best way to make a toggle function?

I made this real quick, I want to know if there are better or shorter ways of toggling.



local toggle = false

if toggle then

	toggle = true

elseif !toggle then

	toggle = false

end



toggle = not toggle

That’s much better than what I had.

You code is nonsense, you don’t need an if/else, you just need:



toggle = not toggle


I know, I changed my post a while ago.