Audio resets on space bar pressed

hi, I have audio set up locally so that when a player touches a part the audio plays. This part is really big and covers a large area but whenever the player presses space the audio resets

Local Script:

Server Script:

Is the part you’re checking with the touched signal always making contact with the player? You say it’s a really big part. The way you scripted the audio, it’ll switch/turn on anytime that touched event triggers.

What (I’m assuming) ends up happening is when the player jumps, they trigger the touched signal again and even though the song is already playing, your local script has it play the song again. This restarts the song.

While I don’t really prefer scripting environment sounds this way. If you were going to stick with this, try :Resume() instead of :Play() and try :Pause() instead of :Stop(). This might help stop the stuttering because it won’t stop the music, just pause and play in the same spot.

Here’s the API documentation


I would suggest trying this using Zone. It allows you to easily establish “zones” which you can check when players enter, exit, and much more.