Superhero Landing

Hi! Thanks for still helping me out even though you already solved my first problem. I appreciate it. So I tried your:

But there’s an error: StateType is not a valid member of Humanoid “Workspace.ZIMOPlayzRBLX.Humanoid”. Thanks for trying to help improve my script because having the player do a 70 second animation just for jumping is kinda annoying. I’m sorry for having to still bother you after all you’ve done.

1 Like

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 :slight_smile:
Let me know if you have any more questions.

3 Likes

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 !

1 Like

No problem, man! Make sure to mark that answer as the solution so anyone else who needs help can get it :slight_smile:

1 Like