I've already searched around but Google keeps giving me completely unwanted topics that just happen to include the words that I'm using to describe my issue. I can't seem to find any other questions on ScriptingHelpers addressing this particular issue either.
Let's say I'm creating a pistol. A very simplistic pistol. I create an instance of a tool and I put a part with the name "Handle" in the tool.
By default, the character's right arm will be raised when the tool is equipped. I think it looks a little unnatural, and I want to adjust my character's arms so that both of the arms are held out in front of the character, so that my character is holding the pistol correctly.
I create an animation using the animation editor plugin with the R15 rig, and I publish it to the website. I inserted a LocalScript into the tool as well as an instance of an Animation. I put in the corresponding ID for the AnimationId property, and this is what I put into the LocalScript:
local anim = script.Parent:WaitForChild("Animation") local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local anim_2 = humanoid:LoadAnimation(anim) local tool = script.Parent tool.Equipped:Connect(function() anim_2:Play() end) tool.Unequipped:Connect(function() anim_2:Stop() end)
I threw this together in about a minute, so the variable placement may seem a little bit unconventional.
Anyways, it plays the animation whenever the player equips the tool. The thing is, the default R15 animations created by Roblox are immediately overriding the animation. The animation plays for a split second and is promptly overriden by the idling animations created by Roblox.
https://gyazo.com/aa5c73c0604ac57af7f964e8080d5c69
Just to be sure, I tweaked the length of the animation multiple times, ranging from 1 second to 5 seconds. The difference was nothing short of negligible.
How do I prevent default animations, created by Roblox, from overriding custom animations?
You have to set your animation's priority to the highest, and make sure your animation is looped. You can do this by editing your animation in Animation Editor.
Here is a similar question that could help you further: https://scriptinghelpers.org/questions/55786/how-do-i-make-an-idle-stance-for-tools