use spacebar to toggle the flashlight being on or off. if you look inside, you can replace the space key with any other key if you wish.
free to use. you don't have to credit me because i'm certain others have used this technique for flashlights in scratch games before. this was honestly just a test to see how much scratch coding i remembered after not making anything for a long time.