doesn't work

I am trying to create a project where you have to wind a music box (it’s a fnaf clone) and when the player right clicks on the music box, it tells the music box to wind. For this to work, I use, but it never does what I want. It always gives me this error:

Then when the music box unwinds all the way, it is supposed to use to “kill” the player, but it gives me his error:

I have searched for people who had the same error, but I could only find people using I tried using and it gave me the same error, even with the “fixed” code.

Can someone help?


Hi @PitchBlackNights,

The setInterval method is missing the “this” context, you can bind(this) to the function
Screenshot 2022-02-08 012852

also same goes for the raycastFirst function

1 Like

Oh… wow… I would have never thought that something this simple would fix all my problems. Thanks!

If you’re ever wondering why something isn’t working when it should, it’s probably some JS shenanigan. This binding thing is usually the culprit, just add .bind(this) to everything just in case and you’re good.