I need a script for when the player walks into a collision for it to activate an audio source

i need a script that activates an audio source when the player walks into it. if you need to see the game just say so

Hi @DemonlordIV,

You can use a trigger to detect when an entity enters a zone, and then activate the sound. Here is a tutorial on how to setup triggers:

https://developer.playcanvas.com/en/tutorials/collision-and-triggers/

Edit: Please avoid opening duplicates posts about the same subject!

ok thanks. and sorry

1 Like

also i dont undestand how

So, the tutorial has instructions on how to add a collision/trigger component to your project. Did you read that?

Now, if you don’t feel comfortable with the coding part, I’d say try doing a couple of introductory tutorials on Javascript. That will give you some experience on how to approach scripting and gameplay logic in Playcanvas.

ok