I've got this bit of code that activates a bodythrust and some sparkles in the player's character whenever they press F. I only want the player to be able to press F once while they're in the air. It'd be even better if they could'nt use it on the ground. How can I make this happen?
Here's the code.
thrust = Player.Character.HumanoidRootPart:FindFirstChild("BodyThrust")
sparkles = Player.Character.HumanoidRootPart:FindFirstChild("Sparkles")
MyMouse.KeyDown:connect(function(key)
if (key:byte() == 102) then
thrust.Force = Vector3.new(0,3000,-10000)
sparkles.Enabled = true
wait(0.25)
thrust.Force = Vector3.new(0,0,0)
sparkles.Enabled = false
end
end)

2 comments
try using the GetState ( ) function of humanoid
That is how you would do it, but not very descriptive.