Animation Faltering?

I’m trying to make a dead by daylight pallet system and I’m trying to make it as smooth as possible.

For some reason whenever you knock over the pallet the player animation kinda breaks - it only happens when the player tries moving during the animation.

I think it makes it look reasonably worse and its been getting on my nerves for awhile.

Hopefully theres a way to fix this!


In the video I try moving around (during the animation) and you can see that my legs try switching to a walking animation

I should also mention the animations n stuff are server sided

function PalletManager:PlayAnimations(side)

	local plr = self.playerActivated

	local char = plr.Character or plr.CharacterAdded:Wait()

	local hum = char:FindFirstChild("Humanoid")
	local humRoot = char:FindFirstChild("HumanoidRootPart")

	local animator

	if hum then
		animator = hum:FindFirstChild("Animator")
	end

	if animator then
		self.Animations.PlayerLeft = animator:LoadAnimation(animations.playerLeft)
		self.Animations.PlayerRight = animator:LoadAnimation(animations.playerRight)
	end	

	if humRoot then
		humRoot.Anchored = true
	end

	if side == "Left" then

		if humRoot  then
			TweenReplication:FireClient(plr, humRoot, "Lock", self.pallet.KnockPosLeft.CFrame)
		end

		self.Animations.PlayerLeft:Play()
		self.Animations.PlayerLeft.Ended:Connect(function ()
			humRoot.Anchored = false
		end)

		self.Animations.PalletKnock:Play()
		self.Animations.PalletKnock:GetMarkerReachedSignal("AnimationEnd"):Connect(function ()
			self.Animations.PalletKnock:AdjustSpeed(0)
		end)
	else		

		if humRoot  then
			TweenReplication:FireClient(plr, humRoot, "Lock", self.pallet.KnockPosRight.CFrame)
		end

		self.Animations.PlayerRight:Play()
		self.Animations.PlayerRight.Ended:Connect(function ()
			humRoot.Anchored = false
		end)

		self.Animations.PalletKnock:Play()
		self.Animations.PalletKnock:GetMarkerReachedSignal("AnimationEnd"):Connect(function ()
			self.Animations.PalletKnock:AdjustSpeed(0)
		end)
	end

end
1 Like

This is probably happening because of the priority you set your “pallet activate” animation to. Try setting the priority to a priority higher than the default walking animation, and it should be fixed.

2 Likes

the animations are* set to action4 priority, would they still be affected*

Action 4 should be the highest level of priority. If that’s the case, then the problem must be coming from elsewhere.
What method are you utilizing to lock the HumanoidRoot in order for the animation to execute in the correct location? If your character can attempt to walk mid-animation I would presume the controls are still activated, yes?
Have you tried stopping all other (including the default walking) animations before playing the pallet one?

1 Like

I’m anchoring the humanoidRootPart and tweening its position from the client to lock it into place.

I’ve tried to disable the animations beforehand but the thing is if they starting walking halfway through how do i stop that?

Is tried setting walkSpeed to 0 but that didnt help.

wait, I stopped all animations before and it fixed it but now if the player holds w throughout all of the animation, after the animation is complete the walking animation won’t resume

Example Video-


(note - I held w throughout all of the video, well, except for the very end)

If you are anchoring the HumanoidRootPart, the player in question will still be able to send movement input to the game, making its character attempt to move and triggering a walk animation.
Instead of anchoring the HumanoidRootPart, try disabling the controls altogether.
You can do this by setting up a LocalScript in StarterPlayerScripts that detects for RemoteEvents or BindableEvents, or whatever event you want, and then disables or enables the controls of said player accordingly.

Here is the LocalScript:

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local PlayerControls = require(game.Players.LocalPlayer:WaitForChild("PlayerScripts"):WaitForChild("PlayerModule")):GetControls()

-- You can run either of these in order to enable or disable player movement controls.
PlayerControls:Enable()
PlayerControls:Disable()
-- You can put them inside a function or a callback to be activated as you wish.

It is imperative the script above is located in StarterPlayerScripts, and not StarterCharacterScripts, since it will most likely result in unwanted bugs if it is deleted and re-created when the player respawns, since it would attempt to require the controls more than once.

As it is said in the code comments, you can put the “Enable()” or “Disable()” lines inside a function or a callback to be activated on command. You’ll then be able to call for it with a Remote or Bindable events just as you are doing on your current script.

Remember! Make sure you run a script to enable the player movement whenever the player character spawns, in order to assure the player doesn’t get soft-locked if they reset while the controls are disabled.

Doing this will let you disable Player movement input on command to whichever player you choose, and therefore will prevent them entirely from ever triggering the walk or jump animations.

In the same script, if you wish, you can add this connection to assure the player controls are always re-activated when the character respawns, ensuring it never breaks.

LocalPlayer.CharacterAdded:Connect(function()
	task.defer(function()
		PlayerControls:Enable()
	end)
end)

Let me know if you have any questions or need any assistance, fellow dev!

1 Like

This works great, my only problem is if the player holds w now, after the animation finishes they can’t continue walking, they have re-press w if they want to continue moving.

I would like it to be in one fluid motion if there running away from the killer

walk - knock over pallet - continue walkin

hopefully I’m not give you too much trouble😬

In that case, you cannot rely on disabling controls as it is not possible to circumvent that side effect.
Two unusual but rather “reliable” ways you might find to circumvent the issue are:

  • Going back to your previous method of anchoring the HumanoidRootPart, and attempting to anchor the player legs as well
  • Altering your animation and making the legs move slightly, so that when it plays, the legs are also affected by it, making it override the default walking animation

Don’t worry about trouble, I’m here to help. Let me know how it goes.

1 Like

This and you can also attempt to disable the animations via…

for _, track in animator:GetPlayingAnimationTracks() do
        if track.Animation and track.Animation.AnimationId == animationId then
                track:Stop(fadeTime)
        end
end
1 Like

Did you put keyframes for the legs in your pallet drop animation?

2 Likes

ig u can edit the animate script so that it doesnt play the animation if ur doing that, thats what i always do

1 Like
  1. The legs do have a subtle animation, doesnt change anything though i guess?

  2. Anchoring the legs does work but stops the legs from playing the animation and is a bit clunky

  3. I was looking for remakes on roblox to figure out if anybody has done something like this and came across this game


    its called banishment and its by a group named “Retro-Redux”

don’t know how they managed to do it tho

the full function* is up top just as a reminder

I might try starting fresh on the script and seeing what happens

Finally got it figured out, i completely rewrote (making it more readable and simpler)

function PalletManager:PlayPalletAnimations(side)
	
	local plr = self.playerActivated
	local char = plr.Character or plr.CharacterAdded:Wait()
	local plrHumRoot = char:WaitForChild("HumanoidRootPart")
	local hum = char:WaitForChild("Humanoid")
	local plrAnimator = hum:WaitForChild("Animator")
	
	local palletAnimator = self.pallet.AnimationController.Animator
	local KnockPosLeft = self.pallet.KnockPosLeft
	local KnockPosRight = self.pallet.KnockPosRight
	
	local playerAnimation
	local playerSide
	
	
	for i, anim in pairs(animations) do
		if anim.Name == "player"..side then
			playerAnimation = plrAnimator:LoadAnimation(anim)
		end
	end	
	
	for i, part in pairs(self.pallet:GetChildren()) do
		if string.match(part.Name, side) then
			playerSide = part
		end
	end
	
	
	local palletKnockAnimation = palletAnimator:LoadAnimation(animations.palletKnock)
	
	if playerSide then
	TweenReplication:FireClient(plr, plrHumRoot, "Lock", playerSide.CFrame)
	end
	
	playerAnimation:Play()
	palletKnockAnimation:Play()
	
	palletKnockAnimation:GetMarkerReachedSignal("AnimationEnd"):Connect(function ()
		palletKnockAnimation:AdjustSpeed(0)
	end)
	
end

I then, instead of using Animation.Ended or anything like that i just used task.wait() for about the amount of time the animation played.

--this is a snippet of the local script
TweenReplication.OnClientEvent:Connect(function (targetedPart, info, targetCFrame)

	if info == "Lock" then
		hum.WalkSpeed = 0
		local tween = TweenService:Create(targetedPart, lockInfo, {CFrame = targetCFrame})
		tween:Play()
		task.wait(0.6)
		hum.WalkSpeed = 16
	end

end)

this is just for anybody wondering if they ever get into trouble

Results:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.