Best way to make a e to open script with a mass amount of doors?

Games like rougue lineage have a system where if your close to a door or doors it opens it when you press e. I was wondering how this is possible considering there is thousands of doors in the game and I doubt they are checking the magnitude of each one, although i could be wrong. Whats the best way to go about making a system like this? Im hesitant to use a for loop to check the magnitude of thousands of doors :frowning:, thats why im asking if there is a better way.

1 Like

They could be using collectionservice? Correct me if iā€™m wrong though.

https://developer.roblox.com/api-reference/class/CollectionService

Edit:
An example of it working with doors, magnitude, and collectionservice:

3 Likes

Thankyou for the reply, ill check it out!

1 Like