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: How can i tell when a player is in the air?

Previous Thread :: Next Thread 
dylanman99 is online. dylanman99
Joined: 26 Sep 2008
Total Posts: 169
15 Mar 2015 12:41 AM
i am wondering how to tell when a player is in the air from a jump or from falling? i need to know when the player is stnading and when the player is in the air. thanks!
Report Abuse
Xymond is not online. Xymond
Joined: 27 Oct 2014
Total Posts: 19
15 Mar 2015 12:46 AM
For example.

game.Workspace.Player1.Humanoid.FreeFalling:connect(function(isJumping)
--code goes in here.
--isJumping is a true/false value to determine whether or not they're jumping.
end)
Report Abuse
dylanman99 is online. dylanman99
Joined: 26 Sep 2008
Total Posts: 169
15 Mar 2015 12:51 AM
Thank you very much man!
Report Abuse
SenseiWarrior is not online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
15 Mar 2015 12:55 AM
Or raycast 2.1 studs down from the torso and check if hit is nil or not. If hit is nil, the player is in the air


Offer on R$2,368 and send on 23,547 RAP
Report Abuse
Xymond is not online. Xymond
Joined: 27 Oct 2014
Total Posts: 19
15 Mar 2015 12:58 AM
On my previous script, you could use a different name for the boolean instead of 'IsJumping' because there is a seperate event for when the player is jumping. Change it to 'IsFalling' to make it easier to read.
Report Abuse
LeitrisArcade is not online. LeitrisArcade
Joined: 15 May 2010
Total Posts: 2127
15 Mar 2015 02:49 AM
@Sensei

That would require a loop, and no-one likes constant loops.

( ͡ಠ ͜ʖಠ)
Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
15 Mar 2015 03:05 AM
Raycasting uses an extreme amount of cpu to calculate.
Just putting that out there.

Report Abuse
LeitrisArcade is not online. LeitrisArcade
Joined: 15 May 2010
Total Posts: 2127
15 Mar 2015 03:14 AM
The way I do it is probably a little bit ugly, but I connect the .Jumping, .FallingDown, and .Freefall events to a functions that make a bool value named "Falling" true, then I connected every other HumanoidStateType to a function that makes "Falling" false. This is linked to my animation script though, so it doesn't look too sloppy.

( ͡ಠ ͜ʖಠ)
Report Abuse
LeitrisArcade is not online. LeitrisArcade
Joined: 15 May 2010
Total Posts: 2127
15 Mar 2015 03:15 AM
*to a function

I'm tired k

( ͡ಠ ͜ʖಠ)
Report Abuse
SenseiWarrior is not online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
15 Mar 2015 01:26 PM
I would have a global function that raycasts down from the torso and returns if hit is true or not

Once I have that and need to check if the player is falling, id just do

if not _G.CharStanding() then


Offer on R$2,368 and send on 23,547 RAP
Report Abuse
awesomebawss is not online. awesomebawss
Joined: 30 Aug 2013
Total Posts: 336
19 Apr 2016 05:19 PM
:O whoa that is way better thanks :D
Report Abuse
CloneTrooper1019 is not online. CloneTrooper1019
Joined: 19 Jan 2009
Total Posts: 6227
19 Apr 2016 05:33 PM
Ew, _G
Report Abuse
awesomebawss is not online. awesomebawss
Joined: 30 Aug 2013
Total Posts: 336
19 Apr 2016 05:43 PM
lol
Report Abuse
Skellobit is not online. Skellobit
Joined: 13 Apr 2016
Total Posts: 12758
19 Apr 2016 05:44 PM
actually the FreeFalling event wont be very efficient for this since it only triggers when the player is falling, not when they are rising
Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
19 Apr 2016 06:10 PM
http://wiki.roblox.com/index.php?title=API:Class/Humanoid/GetState


Report Abuse
IceAndNull is not online. IceAndNull
Joined: 09 Sep 2016
Total Posts: 5
08 Jun 2017 03:07 PM
None of these are working for me
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