Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I get all humanoids that come into a certain range?

Asked by 9 years ago

The only way I can think of is to constantly cycle through every humanoid in the game and checking their distances, and fire a method if a humanoid comes within a certain range, but I feel like that method is very is very ineffective and I was hoping there is a better, cleaner method.

2 answers

Log in to vote
0
Answered by
Diitto 230 Moderation Voter
9 years ago

Officer's answer is very flawed, for you would have to sacrifice the speed and integrity of your game to do so, which is against the main idea of the question.

I am sorry to say( not really ), checking all the humanoids in the game is definitely the best option.

If you make code that is clean and efficient, and is true to it's purpose of collecting the distance between all humanoids and the object using recursion, or make a system that keeps track of all humanoids, magnitude comparison is undoubtedly the best choice.

Ad
Log in to vote
-3
Answered by 9 years ago

Just make a transparent brick and script it with your humanoid script and make sure it is on touch.

Answer this question