So I’ve been trying to make a minigun but whenever I equip it, it plays an animation but then the animation stops after some time. I’ve tried using .Stopped but that didn’t seem to work.
local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local anim = hum:LoadAnimation(script.Parent:WaitForChild("Minigun"))
local tool = script.Parent
tool.Equipped:Connect(function()
anim:Play()
anim.Stopped:Connect(function()
anim:Play()
end)
end)
tool.Unequipped:Connect(function()
anim:Stop()
end)
Humanoid:LoadAnimation() is now deprecated, use Animator:LoadAnimation(), where Animator is a child of a player’s character’s Humanoid, to load the animation.
Yes, the reason why we use Animator because Humanoid:LoadAnimation() is deprecated due to creating multiple of Animators, so I recommend you to add a WaitForChild(“Animator”) to wait for the Animator to load.
Set the animation’s priority to movement or action and make the animation looped in the animation editor (so you won’t have to do anim.Stopped). This is to prevent the default animations (walk, idle, etc.) overriding your animations.
Theres also two other problems: When I stand still the tool disappears and when I walk, the right hand that is holding the handle, goes to a default walking right arm animation.