I have a local script inside a tool. In the same hierarchy level is the handle and animation. For some reason the animation won't play when the tool is used. I tested this exact code from a local script in the StarterGui, but with uis, and it worked just fine. The animation prints Play, then Stop, but does nothing. No errors. Any help is greatly appreciated.
script.Parent.Activated:Connect(function() local animation = script.Parent.Eat local track = game.Players.LocalPlayer.Character:WaitForChild("Humanoid"):LoadAnimation(animation) print('Start') track:Play() wait(1) track:Stop() print('Stop') end)
I think the problem is that you don't have a "Handle" in your tool
local player = game.Players.LocalPlayer repeat wait() until player.Character local char = player.Character local humanoid = char.Humanoid --[[ local handle = Instance.new("Part") handle.Parent = tool handle.Name = "Handle" ]] local tool = script.Parent local EatAnimation = tool.Eat local p = humanoid:LoadAnimation(EatAnimation) p.Priority = Enum.AnimationPriority.Action tool.Activated:Connect(function() p:Play() wait(1) p:Stop() end)