YumERAGON
|
  |
| Joined: 18 Apr 2012 |
| Total Posts: 3893 |
|
|
| 05 Mar 2014 03:50 PM |
local magnitude = (workspace.Part1.Position - workspace.Part2.Position).magnitude if magnitude >= 5 then print("hi") end
|
|
|
| Report Abuse |
|
|
|
| 05 Mar 2014 03:56 PM |
In this case, the magnitude means the distance between part1 and part2.
So what the code does:
If distance between p1 and p2 is SMALLER THAN or EQUAL to 5 then print hi
|
|
|
| Report Abuse |
|
|
YumERAGON
|
  |
| Joined: 18 Apr 2012 |
| Total Posts: 3893 |
|
|
| 05 Mar 2014 03:56 PM |
| bump can someone explain this to me? |
|
|
| Report Abuse |
|
|
YumERAGON
|
  |
| Joined: 18 Apr 2012 |
| Total Posts: 3893 |
|
| |
|
YumERAGON
|
  |
| Joined: 18 Apr 2012 |
| Total Posts: 3893 |
|
|
| 05 Mar 2014 04:00 PM |
| and how would i check if the player is in that radius? |
|
|
| Report Abuse |
|
|
|
| 05 Mar 2014 04:02 PM |
Hm? What are you asking exactly?
You can use the magnitude between a players torso and a brick but im unsure what you are asking for |
|
|
| Report Abuse |
|
|
YumERAGON
|
  |
| Joined: 18 Apr 2012 |
| Total Posts: 3893 |
|
|
| 05 Mar 2014 04:04 PM |
lets say i have a um.. tower that shoots but only if its in a certain distance
thats what im trying to achieve |
|
|
| Report Abuse |
|
|
|
| 05 Mar 2014 04:10 PM |
| certain distance from what? |
|
|
| Report Abuse |
|
|
YumERAGON
|
  |
| Joined: 18 Apr 2012 |
| Total Posts: 3893 |
|
|
| 05 Mar 2014 04:18 PM |
lik ya radius
if the player is in a certain radius then it shoots lemme give it
player + game.Players.LocalPlayer local magnitude = (workspace.Part1.Position - player.Character.Torso.Position).magnitude if magnitude <= 5 then --shoot end
Would that work? |
|
|
| Report Abuse |
|
|
YumERAGON
|
  |
| Joined: 18 Apr 2012 |
| Total Posts: 3893 |
|
| |
|
| |
|