I created a tool that's supposed to play an animation when activated, but it does not. Here is the code.
tool = script.Parent handle = tool.Handle function swing() local player = tool.Parent local humanoid = player.Humanoid local swinganim = tool.handle.swinganim local playAnim = humanoid:LoadAnimation(swinganim) playAnim:Play() wait(2) playAnim:Stop() end tool.Activated:connect(swing)
I'm not the best at animations, but it's probably best to play them from a Local Script.
-- Local Script in tool local plr = game.Players.LocalPlayer local char = plr.Character or plr.CharacterAdded:wait() local humanoid = char:WaitForChild("Humanoid") local tool = script.Parent local handle = tool:WaitForChild("Handle") local swinganim = handle:WaitForChild("swinganim") function swing() local playAnim = humanoid:LoadAnimation(swinganim) playAnim:Play() wait(2) playAnim:Stop() end tool.Activated:connect(swing)-- Edit
I hope I helped. If you have any questions fill free to ask me.
Good Luck!