say i want a door to open and close when i clicked it...how would i get it to go back and forth on each click?
✓ ANSWER ACCEPTED
How do i get 2 functions to switch when i click the block?
1 answer
✓ Accepted answer
Just create a variable and check if it is true or false.
local opened = false
if opened == false then
opened = true
--open door
elseif opened == true then
opened = false
--close door
end
That's the basic logic of it, hope i helped!
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
you helped a lot...u reminded me of this :) thx
if opened then ... else endis MUCH cleanerIt does not make a difference, and I find elseif easier to read.