01 | local bullet = game.ServerStorage.FallingSFX |
02 | local bulletClone = bullet:Clone() |
03 | bulletClone.Parent = script.Parent.Torso |
04 | while true do wait() |
05 | if script.Parent.Humanoid.FreeFalling = = true then |
06 | script.Torso.FallingSFX.Playing = true |
07 | script.Parent.Humanoid.WalkSpeed = script.Parent.Humanoid.WalkSpeed+ 10 |
08 | wait( 0.25 ) |
09 | script.Parent.Humanoid.WalkSpeed = script.Parent.Humanoid.WalkSpeed- 10 |
10 | print ( "Print" ) |
11 | end |
12 | end |
13 | while true do wait() |
14 | if script.Parent.Humanoid.FreeFalling = = false then |
15 | script.Torso.FallingSFX.TimePosition = 0 |
16 | script.Torso.FallingSFX.Playing = false |
17 | print ( "Print2" ) |
18 | end |
19 | end |
Correct code:
1 | while true do |
2 | wait() |
3 | if (script.Parent.Humanoid.FloorMaterial = = Enum.Material.Air) then |
4 | print ( "They're in the air" ) |
5 | else |
6 | print ( "They're on the ground" ) |
7 | end |
8 | end |
You can use the FloorMaterial property of Humanoid:
01 | local plr = game.Players.PlayerName |
02 |
03 | while true do |
04 | wait( 1 ) |
05 | if (plr.Character.Humanoid.FloorMaterial = = Enum.Material.Air) then |
06 | print ( "They're in the air" ) |
07 | else |
08 | print ( "They're on the ground" ) |
09 | end |
10 | end |