generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Detect which side of a brick a player is on.

Previous Thread :: Next Thread 
ElectroTM is not online. 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
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
07 Mar 2016 09:20 PM
if player.Torso.Position.X < Door.Position.X then


To get you started.
Report Abuse
morashsPeasant is not online. morashsPeasant
Joined: 06 Jan 2011
Total Posts: 4944
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
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
07 Mar 2016 09:26 PM
What if the ray doesn't hit the door?
Report Abuse
morashsPeasant is not online. morashsPeasant
Joined: 06 Jan 2011
Total Posts: 4944
07 Mar 2016 09:27 PM
oh yeah, check for that too , thanks king..
Report Abuse
ElectroTM is not online. 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
morashsPeasant is not online. morashsPeasant
Joined: 06 Jan 2011
Total Posts: 4944
07 Mar 2016 09:33 PM
if hit == door and surfaceNormal == Enum.NormalId.Front then
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image