I trying to play a sound, and I can`t understant what I did wrong......I need help

function on_message(self, message_id, message, sender)
    if message_id == hash("contact_point_response") then
		msg.post("main:/man/#sound","play_sound",{delay = 1, gain = 0.5})
    end
end

There’s an extra slash, change “main:/man/#sound” to “main:/man#sound”. If this happens in main/man.script, you should even change it to “#sound”, which is the relative URL. If it’s in another script in either “box”, “controler” or “floor”, it should be “man#sound”.

To debug this, you could put the following line in the init or update function of main/man.script:

print(msg.url())

Then you will see what URL that script has and how you could change it to point to the “sound” instead.

1 Like