Help me on Tool Animation


The animation works when I don’t have the sword, but it doesn’t work when I pick it up.

Code:

local mouse = game.Players.LocalPlayer:GetMouse()

mouse.Button1Down:Connect(function()

local animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation)

animation:Play()

end)

2 Likes

Try to check if the player had the tool equipped, like:

local mouse = game.Players.LocalPlayer:GetMouse()
local animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation)

local Equipped = false

Tool.Equipped:Connect(function()
Equipped = true
end)

Tool.Unequipped:Connect(function()
Equipped = false
end)

mouse.Button1Down:Connect(function()

If Equipped then
animation:Play()
end

end)

(sorry I couldn’t format this better)

the script will have to be modified to get the item from “ReplicatedStorage” Because that’s where the tool should go, so the event triggers and clone the sword model so it will be able to show.

You can set the Animation’s Priority to Action.

You can do it by:

1.Open up Animation Editor.
2.Import the Animation that you want to Edit.
3.Click on “Edit” on top of the Window.
4.Click “Set Priority”
5.Set it to “Action”

Export it and try again.

(Also, here are some articles about Animation Priority and why it doesn’t work.)
AnimationPriority (roblox.com)
Animation Priority? - Help and Feedback / Scripting Support - DevForum | Roblox
AnimationTrack.Priority (roblox.com)

1 Like