Animation acting weird?

so i made an animation a while ago but it only played correctly when i tilted it backwards 90 degrees, i dont know how to fix this


how it should play:



how it actually plays:


also heres the script:

local CollectionService = game:GetService("CollectionService")
local UserInputService = game:GetService("UserInputService")

local Player = game.Players.LocalPlayer
local vCharacter = Player.Character or Player.CharacterAdded:Wait()

local Mouse = Player:GetMouse()
local RockFoundEvent = game.ReplicatedStorage.RockFoundEvent

local NewAnimation = Instance.new("Animation")
NewAnimation.AnimationId = "rbxassetid://15963721047"
NewAnimation.Parent = vCharacter

local Active = false
local HitDistance = 13.5 -- the distance that you can hit the rock from

function StopAnimations(humanoid)
	for i, v in pairs(humanoid:GetPlayingAnimationTracks()) do
		v:Stop()
	end
end

local function DoRaycast()
	-- removed because not related
end


UserInputService.InputBegan:Connect(function(Input)
	if Input.UserInputType == Enum.UserInputType.MouseButton1 then
		local Pickaxe = vCharacter:FindFirstChild("Pickaxe")
		
		if Active == true then return end
		if Pickaxe == nil then return end
		if Pickaxe:IsA("Tool") and Pickaxe.Equipped then
			
			Active = true
			
			local vHumanoid = vCharacter:FindFirstChild("Humanoid")
			local Animation = vHumanoid:LoadAnimation(NewAnimation)
			
			Animation:Play(0.25,10,0.9)
			DoRaycast()
			
			task.wait()
			Active = false
		end
	end
end)
2 Likes

What is the animation priority for this? Animation priority makes a huge difference in playing animations. If this didn’t help, then you probably took the wrong animation

the priority for the animation is action

You can try setting a weight for the animation.

AnimationTrack:Play(0,10,1) -- 1st argument is fadetime, 2nd is the weight and 3rd is the speed.

nope, just moves more suddenly
also, weight?

Weight is basically a measure of say priority. It can be used for interpolation between 2 animations. You can try that by setting weight to a value between 0-1. 1 being no interpolation and 0 being that animation won’t play.

1 Like

Also you say suddenly huh? Try this:

AnimationTrack:Play(0.25,10,0.9) -- 1st argument is fadetime, 2nd is the weight and 3rd is the speed.

Are you sure you took the right animation? It seems different from the one you played in the animation tab

You can stop all the animation tracks then play the animation

function StopAnimations(humanoid)
	for i, v in pairs(humanoid:GetPlayingAnimationTracks()) do
		v:Stop()
	end
end

-- after you call the function, play the animation

yeah, i took the right animation

now it jumps to the start position and jumps to the normal position at the end
also the animation is still tilted backwards

also @yoshicoolTV the script didn’t fix it

is there any other animation playing?

im not sure, i tried what yoshi said but it still didn’t work

this is kinda confusing, do you have the script where you are playing the animation?

the script that starts the animation? i put it in the main post

i didnt notice u edited ur post, illl check it out

i noticed you used humanoid to load the animation which is deprecated. try using the animator instead

local Animator = Humanoid:FindFirstChildWhichIsA("Animator")
local AnimationTrack = Animator:LoadAnimation("Animation")

AnimationTrack:Play()

Also why is your task.wait() empty? Try adding a number. Another reason (unlikely) why this error is happening is probably that you are playing multiple animations at once

And you didn’t use yoshi’s function (referring to your script) soo…

task.wait() adds a very small delay, also yoshi’s script stops other animations but i tried it already and it didn’t work, i also removed it from the script afterwards, i just kept the function

also changing it to animator didn’t work

Yeah but it’s practically useless since you’re making an extremely extremely fast cooldown it doesn’t really guarantee it won’t play the same animation twice. I recommend only enabling Active after the animation has finished.