Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i detect player being in air to make them get a speed boost? and a sound?(Answered)

Asked by 3 years ago
Edited 3 years ago
local bullet= game.ServerStorage.FallingSFX
local bulletClone= bullet:Clone()
bulletClone.Parent= script.Parent.Torso
while true do wait()
if script.Parent.Humanoid.FreeFalling==true  then
script.Torso.FallingSFX.Playing=true
script.Parent.Humanoid.WalkSpeed=script.Parent.Humanoid.WalkSpeed+10
wait(0.25)
script.Parent.Humanoid.WalkSpeed=script.Parent.Humanoid.WalkSpeed-10
print("Print")
end
end
while true do wait()
if script.Parent.Humanoid.FreeFalling==false then
script.Torso.FallingSFX.TimePosition=0
script.Torso.FallingSFX.Playing=false
print("Print2")
end
end

Correct code:

while true do
    wait()
    if (script.Parent.Humanoid.FloorMaterial == Enum.Material.Air) then
        print("They're in the air")
    else
        print("They're on the ground")
    end
end

1 answer

Log in to vote
1
Answered by
Rinpix 639 Moderation Voter
3 years ago

You can use the FloorMaterial property of Humanoid:

local plr = game.Players.PlayerName

while true do
    wait(1)
    if (plr.Character.Humanoid.FloorMaterial == Enum.Material.Air) then
        print("They're in the air")
    else
        print("They're on the ground")
    end
end
0
some changing was needed MadnessMyth 10 — 3y
Ad

Answer this question