redfart
|
  |
| Joined: 17 Oct 2008 |
| Total Posts: 1021 |
|
|
| 09 Jan 2013 05:33 PM |
| Is there any way to have say a number value, and at any point in time this number value tells you how many people are within a certain distance of a brick? |
|
|
| Report Abuse |
|
|
| |
|
redfart
|
  |
| Joined: 17 Oct 2008 |
| Total Posts: 1021 |
|
| |
|
|
| 09 Jan 2013 06:31 PM |
| One way would be to have an infinite loop compare the distance from each player's torso to the part, and add one for each player that is closer than the threshold. |
|
|
| Report Abuse |
|
|
redfart
|
  |
| Joined: 17 Oct 2008 |
| Total Posts: 1021 |
|
|
| 09 Jan 2013 06:39 PM |
I know how to to that
But how would I account for when somebody leaves the area? |
|
|
| Report Abuse |
|
|
|
| 09 Jan 2013 06:41 PM |
| That is dealt with in this procedure. It starts a new count from scratch every time. |
|
|
| Report Abuse |
|
|
redfart
|
  |
| Joined: 17 Oct 2008 |
| Total Posts: 1021 |
|
|
| 09 Jan 2013 07:19 PM |
| Could you explain how to do that? |
|
|
| Report Abuse |
|
|
|
| 09 Jan 2013 08:52 PM |
| Make a table of character torsos in the workspace. Update this constantly. Check if nil when applying function. Ta-Dah! Foolproof. |
|
|
| Report Abuse |
|
|
LFMEB
|
  |
| Joined: 31 May 2012 |
| Total Posts: 66 |
|
| |
|
|
| 09 Jan 2013 08:54 PM |
| Make a table of all the torsos in the workspace. When a child is added or removed from the workspace, update the table. Always check if nil when applying function additionally. |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2013 03:52 PM |
part1 = game.Workspace.Part1
part2 = game.Wokrspace.Part2
while true do wait()
print("Distance: "..(part1.Position - part2.Position.magnitude)) |
|
|
| Report Abuse |
|
|