#how to i make a button toggle
1 messages · Page 1 of 1 (latest)
** You are now Level 5! **
Use userinputservice
the if statement you have there at the end only runs once, and the first time placeBlocksOn is false so it doesnt run. it doesn't magically know to run again when the value changes. structure your code in a different way, such as putting it in a function. also be aware that the opposite is also true, if you set placeBlocksOn to true and then run the function that "activates" your code, setting it to false won't automagically undo whatever your code did, you need another function to turn everything off.
so would i put all the code below the line 26 in a function then move the E input code afterwards and call that function in the first inputbegan?
maybe i should replace the if statement with a while statement