Animation not working properly in game

Hello, i’m trying to make an animation where the user swings a bat when they click the screen but it seems to be “freezy” or, well, buggy. I’m using moon animator, by the way.

What do you want to achieve?

I’m trying to make an animation that plays when the user clicks the screen, it’s as simple as that lol

What is the issue? Include screenshots / videos if possible!

The animation appears to be freezy, laggy and just bad in general. This only happens when the animation is played from the player, as the rig animation works just fine.

Animation on rig

Animation played by the player

The script, if needed:

local tool = script.Parent
local handle = tool:WaitForChild("bat")
local idleAnim = tool:WaitForChild("idle")
local useAnim = tool:WaitForChild("use")
local character = nil
local humanoid = nil
local rightArm = nil
local animator = nil
local idleTrack = nil
local useTrack = nil
local w = nil
local hasEquipped = false

tool.Equipped:Connect(function()
	if not hasEquipped then
		hasEquipped = true
		character = tool.Parent
		humanoid = character:FindFirstChildWhichIsA("Humanoid")
		rightArm = character["Right Arm"]
		animator = humanoid:FindFirstChildWhichIsA("Animator")
		idleTrack = animator:LoadAnimation(idleAnim)
		useTrack = animator:LoadAnimation(useAnim)
	end
	idleTrack:Play()
	local weld = Instance.new("Motor6D", rightArm)
	weld.Name = tool.Name
	weld.Part0 = rightArm
	weld.Part1 = handle
	w = weld
end)

tool.Unequipped:Connect(function()
	idleTrack:Stop()
	w:Destroy()
end)

tool.Activated:Connect(function()
	useTrack:Play()
end)

What solutions have you tried so far?

Looked on the forum, searched for tutorials and i tried remaking the animation 3 times too. This issue doesn’t seem to happen with other tools, where their animation is played correctly even if i’m using the same scripts and methods to make both animations.

a test animation i made to see if this issue was happening with other animations. It’s not!

Since it’s only happening with the bat anims i don’t really know how to fix it as i tried many times. Any help?

4 Likes

You should probably make sure both animations are on different Priroity. Action1 for holding/idle, Action2 for using it is a good idea. Seems like it’s just blending the animations.

5 Likes

both animations are indeed action1, i’ll see if making the use animation action2 fixes it. Thanks!

2 Likes

this is why. I’ll keep this in mind for any other animations. Thank you so much!

2 Likes

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