|
| 23 Dec 2015 08:50 PM |
Say I am trying to fire a event based on how close a humanoid is to a part which method would be more efficient
1) Using a loop to constantly check the distance between the two objects
2) Using the changed event on a moving part such as the torso to check the distance
There is probably a better way I just did not want to come to this question empty handed
|
|
|
| Report Abuse |
|
|
| |
|
DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
|
| 23 Dec 2015 08:53 PM |
| if it's between those two, use the loop. atleast then you can change the polling interval, with the Changed event you can't limit the speed. |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 23 Dec 2015 08:55 PM |
| I'll second that on the loop, simply because Changed doesn't actually fire for physics. |
|
|
| Report Abuse |
|
|
Zztheses
|
  |
| Joined: 29 Jun 2013 |
| Total Posts: 94 |
|
| |
|
KapKing47
|
  |
| Joined: 09 Sep 2012 |
| Total Posts: 5522 |
|
|
| 23 Dec 2015 08:57 PM |
.Changed is better for something that doesn't update that fast Loop is better for something that needs to be done fast
So when the person is AFK it would be better to use .Changed, cos a loop will run even if he's not there which could be slowing down other scripts, but in loops u can change the interval, so I'd say choose loops.
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|