Falling animation plays when the player is stuck to the wall

Hello!

I’m currently making a wall jump mechanic which is generally going okay, however I’ve run into an issue where sometimes when the player jumps into the wall, the falling animation plays, causing the head to sort of rock.

Here’s the part of the script that should stop all other animations and only play the wall stick animation:

local function playWallJumper()
	coroutine.wrap(function()
		for i,v in ipairs(animator:GetPlayingAnimationTracks()) do
			v:Stop() -- part that should stop the other animations
		end
		animationTracks.wallJumper[1]:Play(0.1)
		animationTracks.wallJumper[2]:AdjustSpeed(0.25)
		animationTracks.wallJumper[3]:AdjustSpeed(0.25)
		while isInWall do
			local initTick = tick()
			local random = math.random(5,15)
			repeat task.wait() until (tick() - initTick >= random) or not isInWall
			if not isInWall then
				break
			end
			animationTracks.wallJumper[math.random(2, 3)]:Play()
		end
		animationTracks.wallJumper[1]:Stop(.1)
	end)()
end

The wall stick idle animation is the second highest priority (I can’t remember what it’s called). Any ideas?

Here’s a repro file if you’re interested or need it, the script is in StarterCharacterScripts.
walljump thing.rbxl (183.2 KB)

2 Likes

Perhaps you could try disabling the player’s FallingDown humanoid state?

--//handle wall jump
humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
3 Likes

Tried that as well as with FreeFall and it seems to still be playing the falling animation for some reason.

2 Likes

That’s odd.

Out of curiosity do you know what their current state is when the head is bobbing like that?

Maybe just for testing you could print their humanoid’s current state every frame to see what it’s set to when that occurs.

Another idea, not sure if you’ve tried it, but perhaps you could try re-enabling another state instead. Maybe try something like Landed, just to see if that does anything.

2 Likes

I tried printing the state and it’s printing freefall despite not being enabled?

					humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
					humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
					humanoid:SetStateEnabled(Enum.HumanoidStateType.Freefall, false)
					humanoid:SetStateEnabled(Enum.HumanoidStateType.Landed, false)
					playWallJumper()
local function playWallJumper()
	coroutine.wrap(function()
		print(humanoid:GetState()) --> FreeFall

image

2 Likes

Does it do anything if you re-enable the Landed state??

2 Likes

Nope, it still plays regardless of whether landed is disabled or not.

Oddly enough, changing the humanoid’s state to PlatformStanding makes the head turn side to side sorta, even though the state is FreeFall? It’s not a part of the animation tho so I’m really not sure what it is.

3 Likes

humanoid:ChangeState(Enum.HumanoidStateType.Landed)

Have you tried this? Alternatively, you could edit the Animate script and remove the falling animation from it.

fall = {
	{ id = "http://www.roblox.com/asset/?id=507767968", weight = 10 } 
}

Just tried it and the head is still moving side-to-side, although not as fast as in the video of my previous reply.

I still want the falling animation, I just don’t want it to be playing while the player is stuck to the wall.

I added a copy of the mechanic in the original post if you want to help debug. I’ve added some comments as well, the script is in StarterCharacterScripts.