Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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

1 comment

0

some changing was needed

This discussion is preserved as it was. New answers, comments, and votes are closed.