Animations not playing fully

I am currently working on a combat game, and when I was play testing the animations I saw that they weren’t playing fully, unless I spam played the animation.

This is what the animation looks like in the editor

And this is what it looks like in game

I have already tried setting the animation priority to action, but to no avail.

Animation function:

-- Server Script
local Character = script.Parent

local function PlayAnimation(Animation)
	local Animator = Character:WaitForChild("Humanoid"):FindFirstChildOfClass("Animator")
	
	if Animator then
		local Track = Animator:LoadAnimation(Animation)
		Track:Play()
	end
end
2 Likes

Are you using Motor6D for this animation?

If so then that might be the issue; you need to reconnect the Motor6D to the right arm/handle respectively within the script otherwise the animation can’t play since the motor isn’t doing anything if the motor isn’t attached to anything.

I do have the motor6D set up, the main issue is that the torso/body itself isn’t starting all the way back like in the animation editor.

I think you do not have any errors in the output but anyways, i had the problem that my animation not loading cause it was loading on the animator of the humanoid.
So try instead of loading the animation in the animator, loading it in the humanoid, it might work

local character = script.Parent

local function PlayAnimation(Animation)
          local hum = character:WaitFirstChild("Humanoid")
          if hum then
               local Track = hum:LoadAnimation("Animation")
               Track:Play()
          end
end

This didn’t seem to change anything as I still have the same issue. Also I’m not 100% sure but I think that loading animations via the humanoid was depreciated, which is why I used the animator in the humanoid.

Do you mind sending the script where you use the function?

local function PlayAnimation(Animation)
	local hum = Char:WaitForChild("Humanoid")
	
	if hum then
		local Track = hum:LoadAnimation(Animation)
		Track:Play()
	end
end

--[[function PlayAnimation(Animation) -- older method I tried
	local AnimTrack = Char.Humanoid:LoadAnimation(Animation)
	AnimTrack.Priority = Enum.AnimationPriority.Action
	AnimTrack:Play()
end--]]

function OnTouch(PartHit, Humanoid)
	print(PartHit.Name)
	Humanoid:TakeDamage(25)
end
--

-- Moves

local function BasicAttack(Player,InputType)
	if Player == LocalPlayer then
		PlayAnimation(AnimationPath.BasicAttack)
		Hitbox:HitStart(2)
	end
end

-- Pass event stuff
Remotes.BasicAttack.OnServerEvent:Connect(BasicAttack)

Hitbox.OnHit:Connect(OnTouch)
Tool.Equipped:Connect(function()
	Char = Tool.Parent
	LocalPlayer = game.Players:GetPlayerFromCharacter(Char)
	RaycastParams.FilterDescendantsInstances = {Char}
end)

--

So I found that an easy fix for my issue was just extending the duration of the first frame. I don’t
think this is the best solution, but I’ll stick with this until I can figure something else out.image

3 Likes

Roblox has recently made a change to how animations work, so that might be the reason.

And we don’t even have a say in it. They’re forcing it on us, and our only solution is to increase the priority of the animations.

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