Is this piece of code vulnerable to heavy computation or fast-paced inputs?

Take a look at this example code:

local displaying = false

some.Event:Connect(function()
	if displaying then
		--some code to stop displaying
		
		displaying = not displaying
	else
		--some code to start displaying
		
		displaying = not displaying
	end
end)

Say it was a menu toggler, and say that I downloaded an autoclicker. If I were to put my autoclicker to use on this toggler, would something break?

Is it as secure as straightly setting the first blah to false and the second blah to true?

Or is it completely fine?

It shouldn’t break the script, since you’re using if statements and booleans, it will run respectively with your boolean, and not player/client based.