Sounds not working properly?

I’ve used this code to play a sound (it also does other things, but focus mainly on sound for this How Do I…?) every time the player clicks, there’s also other code that plays the same sound with this code every time the spacebar or up key is pressed.


The problem is that the sound inconsistently does not play.
I can give an unfinished link of the current version of the game to provide an example.

Have any ideas what could be going wrong?
I made sure to prevent any overlap I stopped the sound when pressing each button, but I don’t believe that’s the problem, because I did the same test without stopping the sound.
I also tried putting each sound on its own channel, that also didn’t work.

Not sure why, but a few suggestions:

  1. get rid of the trigger once. The release mouse button condition won’t be true for 2 consecutive game frames.
  2. remove the stop sound action
  3. try placing the layer visibility checks in one event, and the released mouse button (with play sound) in a subevent off that.
  4. Get rid of those unnecessary conversions between numbers and strings. This
    image

    is the same as

    image
1 Like

Well for the fourth one, there’s a very complicated reason for why I did that, but basically, it’s an extension that requires all of that to function properly, it converts a LARGE number, like a scientific notation into it’s written form from the notation, and can also write it as a more simple form, like 1.213 decillion and whatnot.
Sadly, though, while what you said worked a little bit it seems, it didn’t work completely, so I’m still confused about that.

But you’re converting CoinAmount to a number. It’s already a number. Same for the other 4 variables.

But onto the issue at hand:

I suggest you debug by making a copy of the click event, disabling the copied event and stripping down the original event to a single “button is released” condition and a single “play sound” action. If this causes the intermittent playing of the sound, then it’s possible you have events elsewhere that are interfering with the sound channel.

Actually, it’s a string variable, that way you can store the written number without the number turning into a scientific notation when you try to use something like SubStr on it.

I have not done anything to the sound channel, and I tried what you said, but it did not work.
The only thing I have that could be messing with the sound channel is maybe preloading the sound.
Another problem with that, though, is that it only loads the sound after I click for the first time.