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
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 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.
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.