Good evening! Last night, I was working on animations for a raycast firearm I am working on. The aiming animation was working fine, however the fire animation wasen’t. When I woke up, I hopped ingame, and tested it. For some reason, which I can not and will not understand, the fire animation magically worked. I then added another, ‘resting’ animation, then my fire animation simply stopped working. I did some digging around, and apparentally the maximum amount of animations that can be loaded in a short period is 10, however I am by no means going past this limit.
Is anyone able to help?
local tool = script.Parent.Parent
local aimanim
local patrolanim
local fireanim
local cursor = game.Players.LocalPlayer:GetMouse()
local uis = game:GetService("UserInputService")
local atpatrolrest = false
local ammoloaded = 30
tool.Equipped:Connect(function(mouse)
aimanim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Parent.Animations.AimAnim)
patrolanim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Parent.Animations.PatrolRestAnim)
fireanim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Parent.Animations.FireAnimation)
I made sure all animation IDs are correct, and it worked this morning without any edit, so that can’t be the issue.
Yes, I thought that too, to my memory, they are both on the ‘Movement’ priority, and they haven’t been changed, so I don’t think that could be the issue. I’ll go ahead and double check. Give me some time.
All Roblox animations use the Core priority, with some exceptions (Jump and toolnone) using Idle. Use a higher priority to fix this issue. Movement is recommended so that an Action animation (e.g. firing) can override a movement animation.
If that animation is Movement, not sure how toolnone is overriding it - shouldn’t be.
I set the aiming animation to idle, however that didn’t work. I just set the aiming animation to Movement, and set the fire animation to Action, however that isn’t working either now.
When I set the aiming animation to movement, yes, it overrid the toolnone, but firing still a negative.
You have to make a Motor6D between the tool and the body part connecting to it. When you select the tool, the motor6d is made. When you unselect it, the motor6d is destroyed.
Also, the “RequiresHandle” property in the Tool might be a problem. Uncheck that, it might help.
local tool = script.Parent.Parent
local cursor = game.Players.LocalPlayer:GetMouse()
local uis = game:GetService("UserInputService")
local atpatrolrest = false
local ammoloaded = 30
function animate()
local aimanim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Parent.Animations.AimAnim)
local patrolanim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Parent.Animations.PatrolRestAnim)
local fireanim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Parent.Animations.FireAnimation)
end
tool.Equipped:Connect(function(mouse)
animate()
end)
Gave it a try, didn’t work since the animations are defined in the function scope. Fixed it up by putting the variables above the function, and still didn’t work.
Mhm. This is so we can make sure that the animations are loading properly, while making sure its smooth. A regular wait string can get a bit messy and mess up how smooth your code functions.
Alright. This should work as many people mention the overriding that could be happening. If the wait statements dont work, please try extending the length just to see if we have a fix to the issue. We can always mess with the wait length later.
I moved them around, still seems like the resting animation and aiming animation still work, even though resting LoadAnimation was replaced with where the fire animation was loaded. It seems like something is broken with fire animation. I can’t find anything though
Use a print statement and mess around with it more. If it still doesnt work only for that animation, you should figure out issues with that specific animation.