Issue playing sound

Hi!

Can’t figure this out…

Why won’t the sound play when calling the variable?!

[lua]blip = audio.loadSound(“blip.wav”)

– then, later in the code, within a function:

if ( canjump == “play” and event.phase == “began” ) then
print(touched.jsound) – terminal prints “blip”
audio.play(touched.jsound) --will NOT play the sound
audio.play(blip) --THIS plays the sound!
end[/lua] [import]uid: 187595 topic_id: 32322 reply_id: 332322[/import]

can you show us where you are setting touched.jsound ? [import]uid: 19626 topic_id: 32322 reply_id: 128651[/import]

I believe audo.play() requires an object of audioHandle and not a string (which I am assuming is what touched.jsound is) and is set to "blip:

not sure why you need touched.jsound, but maybe try

[code]

touched.jsound = “blip”

– then in your if statment
if (canjump … ) then
print(touched.jsound) – terminal prints “blip”
blip = audio.loadSound(touched.jsound … “.wav”)
audio.play(blip)

end
[/code] [import]uid: 62015 topic_id: 32322 reply_id: 128665[/import]

can you show us where you are setting touched.jsound ? [import]uid: 19626 topic_id: 32322 reply_id: 128651[/import]

I believe audo.play() requires an object of audioHandle and not a string (which I am assuming is what touched.jsound is) and is set to "blip:

not sure why you need touched.jsound, but maybe try

[code]

touched.jsound = “blip”

– then in your if statment
if (canjump … ) then
print(touched.jsound) – terminal prints “blip”
blip = audio.loadSound(touched.jsound … “.wav”)
audio.play(blip)

end
[/code] [import]uid: 62015 topic_id: 32322 reply_id: 128665[/import]

Thanks a lot, I will try this! [import]uid: 187595 topic_id: 32322 reply_id: 128944[/import]

Thanks a lot, I will try this! [import]uid: 187595 topic_id: 32322 reply_id: 128944[/import]