# Script error - TypeError: cannot read property 'ended' of undefined

I'm getting an error on my project where in a particular script, I get the error: TypeError: cannot read property 'ended' of undefined
I do not know what this means or why it is occuring.
Can someone help me solve this?

Could you please explain what the code does?

The code runs after passing a certain 'x'. On a loop, the script will set the panning and volume of a sound, before playing the sound (the 'counter' variable was to track where the code was currently. Not the source of the issue). Then the script will repeat code that detects if certain keys are pressed, if there is sound from the microphone and if a variable=1. If any condition is met, a broadcast will send and the script stops. Else, it will repeat for the specified amounts.

Short version: In a loop, a sound is set up and played, then for a certain amount of repeats it detects for particular conditions. If any are met, the script broadcasts and ends.

That error usually means the sound called "Bang" doesn't exist, or it's named incorrectly.
Also, welcome to the forums!

But if you make easy project, show this error:

So, problem is elsewhere

I think it might have something to do with the way the sound file.

The sound file is completely fine. It seems to be an issue with the script repeating, as if the script is unable to detect an end.

Can you send link to this project?

It's currently unshared.

Am I the only one seeing sycreeper's username a lighter gray than the other usernames?
EDIT: I don't anymore. That was weird (almost as weird as @bh becoming @Brookie).

I don't see a difference haha

Suddenly, I don't either.
EDIT: It is was happening to dangduomg here: How to make a closure in Snap!?

I see it too... is it some kind of plugin that makes new users names lighter?

I only see bh having a lighter name, and I assume that's because he's a developer.

Sorry, but when I build this script, all is good. Others script, not show in this screen have impact on this script.

That's a little strange. I ended up modifying the script and I think it was the repeat block that caused it for some reason I don't know. I've reworked the script and everything is fine but it doesn't make sense why I got the error.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.