How do I detect once the music has finished (djs v13.12.0) [Solved]

I have messed around with the player.on() function with createAudioPlayer and such but I can not find a solid way to loop it?

Heres my code:

player.on('stateChange', () => {
                                if (currentSong === null) {
                                    player.stop()
                                    resource = null
                                } else {
                                    player.play(resource)
                                }
                            }

I have tried unsubscribe, state change, idle and error and every single one just doesn't work
Can somebody help me?

I do not have any errors at all in the output and I put a console.log in the player and it wouldn't print anything
Was this page helpful?