ElectroTM
|
  |
| Joined: 23 Nov 2012 |
| Total Posts: 1135 |
|
|
| 07 Mar 2016 09:16 PM |
I need a way to find out which side of a door a player is on. No matter how complicated, I need ideas. Please help. :)
y-y-you too... |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2016 09:20 PM |
if player.Torso.Position.X < Door.Position.X then
To get you started. |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2016 09:24 PM |
local ray = Ray.new(torso.Position,(yourDoor.Position - torso.Position).unit * 999) local hit,pos,surfaceNormal = workspace:FindPartOnRay(ray)
if hit and surfaceNormal == Enum.NormalId.Front then print('Player is at the front of the door') end
Should work, basically the third value returned by :FindPartOnRay() is the surface normal (face) of a part if any was hit..
|
|
|
| Report Abuse |
|
|
|
| 07 Mar 2016 09:26 PM |
| What if the ray doesn't hit the door? |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2016 09:27 PM |
| oh yeah, check for that too , thanks king.. |
|
|
| Report Abuse |
|
|
ElectroTM
|
  |
| Joined: 23 Nov 2012 |
| Total Posts: 1135 |
|
|
| 07 Mar 2016 09:31 PM |
How do I check for that? Just put in what king had?
y-y-you too... |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2016 09:33 PM |
| if hit == door and surfaceNormal == Enum.NormalId.Front then |
|
|
| Report Abuse |
|
|