Most of the time, you will only want players to activate your trigger events, and now that we have a way to access the entity, we can narrow it down to only listen for players, using the power of tags, which we’ll discuss in a later step.
We’ll also delete the onTriggerStay and onTriggerExit functions now, since in this case we only need to know when the player enters an area.
- Delete the onTriggerStay and onTriggerExit functions.
- In the onTriggerEnter functions, create an if-statement
- Give the if-statement the condition something.tags.has(“player”)
- Make sure the closing } comes after the console.log