Tool Grip seems to mess up tool Animation

I would like to achieve a simple idle holding animation for my pillow however the arms don’t align.


When I initiate the swing animation they align as it is part of the animation however right when we switch back from the swing to the idle holding the arms go back to misaligning. One arm is straight and the other isn’t which could suggest that the tool grip is influencing the misalignment. I attempted to set the idle animation’s priority to action and that still didn’t fix it.

Script:

local Idle = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Idle)
local Swing = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Swing)

script.Parent.Equipped:Connect(function()
	Idle:Play()
end)

script.Parent.Activated:Connect(function()
	Swing:Play()
	wait(Swing.Length)
	Idle:Play()
end)

script.Parent.Unequipped:Connect(function()
	Idle:Stop()
end)

If you have a solution to this issue please don’t hesitate to comment it here.

Thanks for your time.

1 Like

For starters, I noticed it’s run out of a local script, as LocalPlayer can only be used in one. From some quick tests I ran, it does appear that the LoadAnimation function might replicate to the server if called from a LocalScript. However, I’ve encountered many more errors trying to do so vs. simply using a server script. You should just use a server script instead, because not only can you load an animation from one, but you’ll be able to do more with a server script than just animate/adjust ui. There’s no need to use a local script, at least in this instance.

Another thing is that when you receive the Activated script signal, you make the script play the idle animation again after the swing animation has concluded. If the idle animation is looped and has a lower animation priority than the swing, you won’t have to do this. The swing will override the idle animation, and once the swing animation is completed, the character will return to the idle stance. If for whatever reason that doesn’t work, you should consider stopping the idle animation when the swing starts and then resuming it. Right now you just have it play again for seemingly no reason.

Also, you might have to change the tool’s default grip to accommodate for the idle animation. If everything is animated properly you likely won’t have to change it dynamically in the script. Just make sure the grip is in-line with the animations.

I was easily able to get it working in my own game, so let me know if you have any more problems after executing any of these potential solutions.

I attempted to run it on the server. It made no difference. I even set the animation to looped before publishing and it still did nothing. I even tried to change the grip but it doesn’t seem to really make much of a difference. Here is my server script. `game.Players.PlayerAdded:Connect(function(Player)
local Tool = Player.Backpack:WaitForChild(“Pillow”)
local Idle = Player.Character.Humanoid:LoadAnimation(Tool.Idle)
local Swing = Player.Character.Humanoid:LoadAnimation(Tool.Swing)

Tool.Equipped:Connect(function()
	Idle:Play()
end)

Tool.Activated:Connect(function()
	Swing:Play()
	wait(Swing.Length)
	Idle:Play()
end)

Tool.Unequipped:Connect(function()
	Idle:Stop()
end)

end)`

I don’t understand. Why are you using an entire script signal to define the player? That seems a bit arbitrary… You can make a more simple variable to do the same thing instead.

Assuming you’re only trying to get the animator, you can probably just do something like this (if the tool is located in the starterpack): local Animator = Tool.Parent.Humanoid.Animator or Tool.Parent.Parent.Character.Humanoid.Animator

Also, make sure the animation priorities are correct. The idle should be set to Idle and the swing should be Action. If that doesn’t work try making the idle Action and the swing Action2.

I did what you said with the animation priorities and it still doesn’t make a difference. When the swing animation plays at the end the hands are in the normal position but then they instantly get misaligned again.

I don’t really understand, then. Can you try and record a video so I can get a better view of what’s going on? I made it in my own game and it works just fine. You could also send me a model of the tool and I can work on it in studio.

My screen recorder is broken but I’ll try to explain better.
image
The animation is meant to make it so the player is holding up the pillow with straight arms. Roblox uses the right arm to hold tools. This is the left arm and it’s perfectly straight and follows the animation. While on the right arm the arm isn’t straight and the tool grip animation Roblox made interferes with it.

This is what happens with the right arm. It should be straight and follow the animation like the left arm but instead it mixes with the tool grip animation.

I found a solution I just had to add a keyframe to the torso. Thanks for your help @CookieWasHacked !

1 Like

That’s great. Sorry I couldn’t get back to you sooner; I was going to send you something I had made to cross-reference but I was a bit too busy. Good luck on your project.

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