Oh, my bad. I just looked into humanoid StateType, it looks like you get the humanoid’s current state by doing the following:
Humanoid:GetState();
as opposed to
Humanoid.StateType
Here’s the corrected code:
local Humanoid = char.Humanoid;
local fallingTime = -1; -- will be initialized later; the time when the falling started
Humanoid.StateChanged:Connect(function(PreviousState, NewState)
if NewState == Enum.HumanoidStateType.Freefall then
if Humanoid:GetState() == Enum.HumanoidStateType.Freefall then --Gets the humanoid state, and then checks if the humanoid is in freefall.
fallingTime = tick(); -- tick() gets the current time; we can subtract the time they started falling from the time they land to see how long they fell
end
elseif NewState == Enum.HumanoidStateType.Landed then
if (tick() - fallingTime > 10) then --where 10 is the amount of seconds you want to fall for a superhero landing
local animTrack = Humanoid:LoadAnimation(Landing);
animTrack:Play();
local explosion = Instance.new("Explosion"); -- This creates the explosion
explosion.Position = char.UpperTorso.Position; -- This positions the explosion at the character's torso
explosion.BlastRadius = 0; -- Assuming you don't want the explosion to do any damage, include this line. Otherwise, the explosion will kill the player.
explosion.Parent = game.Workspace;
-- explosion will only be visible for the client who lands; use remote events to make the explosion on the server side.
end
end
end
Also, no worries about me helping you. We all start somewhere
Let me know if you have any more questions.
It’s perfect! Thank you so much!!
Now I’ve got the Superhero Landing locked down thanks to you. I still can’t thank you enough.
So Have a good day/night !