How do I fix this code to trigger an event for approaching a door?

So recently, I have found a script the opens and closes a door when one gets near it (I dont know who made it, I wish I could give credit) and after making a few adjustments to the code, I managed to become clueless when it came to this:

I want to make it find all the doors in the game with the name “ElementDoor” so that when a player walks near it, it fires that doors individual remote event, however, I cannot wrap my head around how to do this, could I get any help?

Thanks!

EDIT: the “Obj” variable is the folder that holds the remote event in the door.

Never mind the post, I managed to figure out a solution :slight_smile:

Instead of saying that you found a solution, describe the solution you found. This can be beneficial for those experiencing the same issue.

5 Likes

I never thought of this :o

Basically, what I did, was I made the script search the entire workspace for the certain door, and when you came close to it, it made it into a variable that would be used further in the code like so:

1 Like