So, I'm trying to make a script that when a player is falling for a certain amount of time and depending on their speed, an effect plays. Essentially, when a player is falling at a certain speed I want an effect to play, So screen shaking and Distortion. My Issue here is that I don't know how to detect how fast a player is falling. Would I use body velocity? and what Body velocity would I look for? I'm aware I can use Humanoid.FreeFall to detect falling but how would I know how far and the velocity of the player? Here's what I have:
local Humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
Humanoid.StateChanged:Connect(function(_, new)
if new == Enum.HumanoidStateType.Freefall then
print("Falling")
end
end)
Edit: one last thing, if I were to use velocity what would I get the velocity of? The Torso? HumanoidRootPart? or something else?
just ended up doing this and it worked.
local Humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
local vel = game.Players.LocalPlayer.Character.Torso.Velocity
Humanoid.StateChanged:Connect(function(_, new)
if new == Enum.HumanoidStateType.Freefall then
print("Falling")
wait(1)
vel = game.Players.LocalPlayer.Character.Torso.Velocity
if vel.Y < -100 then
game.Players.LocalPlayer.Character.Head.Fall:Play()
game.Players.LocalPlayer.Character.Head.Fall.Looped = true
end
end
end)
the wait(1) could be improved, I'm still working on it. I'll update later.
