If player's touching this, or if it's touching that, run the same script (SOLVED)

Hey!

Maybe the title isn’t explainative enough, so, what i want to do is that i want an object to check if its touching button1, then open the door, but, i also want to do button2 to make the same exact script, but, ok, let’s say i have a long script (in this case i don’t but it is an example i’m not doing what i say here) and i want the door to check if i’m touching button1, or button2 not if i’m touching button1 and button2.

I know this is long but i’ve been having problems with this since i started trying to make a rhythm game.

Sorry, I could not understand what you want to achieve… the description is a little bit confusing to me…

Is this what you mean?

if(player.hits(button1) || player.hits(button2)) {
// call function...
}
1 Like

I’m a little puzzled too.
could you try to explain more?
It seems you want the OR condition ( || ) Jovanny showed you

1 Like

Yea!

I had some problems with || but i had to use }else{ instead of !, ty so much!!