Animation doesn't play correctly through script

The problem I’m having is that an animation isn’t happening properly on click when I have a tool equipped in a game I’m working on, even though it looks just fine on the animation editor. I thought it may be a problem with the fact that it’s an equipped tool, or maybe one of the other scripts in my game are interfering with the animation, so I went to test in a baseplate with the following scripts on me and a dummy respectively:

script.Parent.ClickDetector.MouseClick:Connect(function(Player)
	local Character = Player.Character
	local Hum = Character:FindFirstChild("Humanoid")
	local Animator = Hum:FindFirstChild("Animator")
	
	local PunchAnim = Instance.new("Animation")
	PunchAnim.AnimationId = "rbxassetid://122651488633647"
	
	local PunchAnimTrack = Animator:LoadAnimation(PunchAnim)
	
	PunchAnimTrack:Play()
end)
local Animator = script.Parent.Humanoid.Animator

local PunchAnim = Instance.new("Animation")
PunchAnim.AnimationId = "rbxassetid://122651488633647"

local PunchAnimTrack = Animator:LoadAnimation(PunchAnim)

PunchAnimTrack:Play()

As you’d probably expect from the fact that I’m posting here, I still have the same issue, and I have no idea what could possibly be causing it. Nothing is anchored if that information helps at all, and any help would be greatly appreciated. I’ll post what the animations look like in game, along with the animation editor below.

Animation Editor:

Dummy In game:

Me In game:

Again, Any help would be greatly appreciated.

3 Likes

This animation was also imported from blender if that changes anything.

2 Likes

I just readed your post more carefully.

In the standard Animate script, when entering the game there is an animation of the torso, that it is fixed.
You should remove the animation, when equipping tool

give me sec i`ll show you

2 Likes


Снимок экрана 2024-09-10 в 19.54.24

You have to change those id’s, or remove them from everything
Снимок экрана 2024-09-10 в 19.54.55

1 Like

In the last screenshot, should I remove everything pictured there, or should I only remove laugh?

1 Like

If you’re inexperienced, I’ll explain it to you:

  1. Go into the game through the studio and copy the Animate script inside your character
  2. Finish the game, and paste the copied script into StarterCharactersScripts
  3. Find these objects inside the script: toollunge, toolnone, toolSlash. Inside these objects will be animation objects. Give them an id of 1
  4. Go to the Animate script and assign id 1 to the same objects, but in the script (screenshot attached).

And that’s it

1 Like

If it still doesn’t work for you, or you want to leave your hand raised. You can use Set Animation Priority. (if you set Action4, your animation will be fine)

1 Like

Still having the same issue. This is what the script in startercharacterscripts looks like:
image
and toolnone is the only one that appears as an object in the workspace


I changed the value of the animation inside to this:

but I still have the same issue.

ah ok I’ll try this out (character limit)

2 Likes

try my another variant, i think its your way

1 Like

It seems to be an issue with me having imported the animation from blender. I don’t know why it seems fine in the animation editor, but I made a quick replacement on the basic animation editor and it seemed to work fine. Sorry for wasting your time.

2 Likes

It looks like the animation isn’t relative to the humanoid root part. Are you trying to animate the humanoid root part some how instead of the torso?

You could also try increasing the animation priority and seeing if the problem is from other animations playing at the same time.

1 Like

Sorry I fixed it, I pretty much just had to upload the animation again after importing it. I’m not sure why it works but it did.

2 Likes

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