|
| 20 May 2016 09:51 PM |
I was wondering how I'd check if a part is touching another part, and to give off a true or false value depending on the answer.
~MightyDantheman |
|
|
| Report Abuse |
|
|
|
| 20 May 2016 09:55 PM |
I basically need it to detect is the player is touching any part, and enable a BoolValue once detected. Of course, the opposite would happen when the player is not touching anything (which would happen when the player is jumping or falling).
~MightyDantheman |
|
|
| Report Abuse |
|
|
|
| 20 May 2016 09:57 PM |
http://wiki.roblox.com/index.php?title=API:Class/BasePart/Touched
helo |
|
|
| Report Abuse |
|
|
|
| 20 May 2016 09:58 PM |
Thank you.
~MightyDantheman |
|
|
| Report Abuse |
|
|
|
| 20 May 2016 10:00 PM |
Wait, how would I invert that?
~MightyDantheman |
|
|
| Report Abuse |
|
|
|
| 20 May 2016 10:14 PM |
I just noticed that the Humanoid comes with a Jump detection thing, but it doesn't enable when you just walk off an edge (without jumping).
~MightyDantheman |
|
|
| Report Abuse |
|
|
| |
|
|
| 20 May 2016 10:52 PM |
local part = script.Parent local bool = false
part.Touched:connect(function(otherPart) bool = true end)
|
|
|
| Report Abuse |
|
|
Isosta
|
  |
| Joined: 10 May 2015 |
| Total Posts: 14729 |
|
|
| 20 May 2016 10:56 PM |
game.Workspace.Player.Humanoid.StateChanged:connect(function(state) if state == Enum.HumanoidStateType.FreeFall then --code end end) |
|
|
| Report Abuse |
|
|
Aethex
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 2193 |
|
|
| 21 May 2016 12:00 AM |
...what are all these suggestions? Does no one here know what TouchEnded is?
local touching = false;
-- assuming "part" is defined at the part being touched
part.Touched:connect(function() touching = true; end)
part.TouchEnded:connect(function() touching = false; end)
--do checks down here wherever you need them, just see if "touching" is true or not |
|
|
| Report Abuse |
|
|
Isosta
|
  |
| Joined: 10 May 2015 |
| Total Posts: 14729 |
|
|
| 21 May 2016 12:24 AM |
| I just saw that he wanted the character falling or something I didn't read the whole thread. |
|
|
| Report Abuse |
|
|
|
| 21 May 2016 10:41 AM |
Thanks. I never knew this function existed. I've been using the hit detection this whole time. .o.
~MightyDantheman |
|
|
| Report Abuse |
|
|