Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 22 Nov 2013 08:42 PM |
if part.CFrame.Y >= workspace.Infocus.Torso.CFrame.Y then -- end
Like that?
I cant test momentarily due to me being on an ipad. |
|
|
| Report Abuse |
|
|
DrWaffler
|
  |
| Joined: 16 Sep 2011 |
| Total Posts: 4248 |
|
|
| 22 Nov 2013 08:44 PM |
I believe the only way is to cast a ray straight up.
At least I haven't heard of any other method, and I haven't really had need of checking what's above my head yet.
--[Territory Conquest Developer, Valerian Studios Developer, Business Casual Narwhal Moai. ]]-- |
|
|
| Report Abuse |
|
|
|
| 22 Nov 2013 08:47 PM |
DrWaffler, please refrain from posting on threads if you don't know the answer. You're only serving the purpose of misleading or confusing the OP.
OP, you would want to do something like this
local torsoY = character.Torso.Position.Y local partY = part.Position.Y
if partY - torsoY == 5 then ...
Remember, difference is just another word for what you get when you subtract two numbers. |
|
|
| Report Abuse |
|
|
DrWaffler
|
  |
| Joined: 16 Sep 2011 |
| Total Posts: 4248 |
|
|
| 22 Nov 2013 08:51 PM |
@Arceus
I believe he is only wanting if it is directly above his head.
The y coordinate could be the same, even if the X and Z aren't, so the brick could be 10,000 studs away, but 5 studs up from where his torso is on the y axis.
--[Territory Conquest Developer, Valerian Studios Developer, Business Casual Narwhal Moai. ]]-- |
|
|
| Report Abuse |
|
|
|
| 22 Nov 2013 08:55 PM |
"I believe he is only wanting if it is directly above his head."
If that's what he wants, all he needs to do is add a few more conditions to the check
local torsoX, torsoY, torsoZ = character.Torso.Position.X, character.Torso.Position.Y, character.Torso.Position.Z local partX, partY, partZ = part.Position.X, part.Position.Y, part.Position.Z
if partY - torsoY == 5 and partX == torsoX and partZ == torsoZ then ... |
|
|
| Report Abuse |
|
|
|
| 22 Nov 2013 08:57 PM |
Additionally, he could do this
local torsoP = torso.Position local partP = part.Position local idealDifference = Vector3.new(0, 5, 0)
if partP - torsoP == idealDifference then ... |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 22 Nov 2013 10:14 PM |
| You should also compare it with the size of the torso and the part, so you don't have to be perfectly and exactly right under it |
|
|
| Report Abuse |
|
|
|
| 22 Nov 2013 10:33 PM |
| and dem floats shud b rounded. |
|
|
| Report Abuse |
|
|