Help adding sound

I know l sound kind of like a noob, but im having troubles adding sound into a game im making. Well not really a game more like a joke. But anyway, when the Inside Playdate document said playdate.sound.fileplayer:play([repeatCount]) how do you add repeatCount? It will not accept nothing, but i just dont know how to do it.
Thanks in advance!

So in theory you just have to load your sound when you game starts or your level load with
mySound = playdate.sound.fileplayer.new( "sound_file" )

And when you want to trigger the sound you just call
mySound:play()

And if you want to repeat the sound two times
mySound:play( 2 )

Does that help? If not you could share the error you get and the code that trigger the sound, that would help us figuring out the problem.

Thanks, ill try that.

The console says this: main.lua:4: attempt to index a nil value (global ‘mySound’)

stack traceback:

main.lua:4: in function main.lua:1

Never mind. Got it to work

1 Like

HOW ?! Please explain I'm getting it wrong !

Well actually I just removed .wav from the path and it worked... weird -_-