Hello, im making a tool and i make a animation on it. when i test my tool it dosen't play and the output tells me: 17:16:59.005 - Play is not a valid member of Animation 17:16:59.009 - Stack Begin 17:16:59.014 - Script 'Workspace.TheEdyGamerTroll23.Chip.LocalScript', Line 12 17:16:59.018 - Stack End
Here's my script
Tool = script.Parent local player = game.Players.LocalPlayer repeat wait() until player.Character ~= nil local hum = player.Character:WaitForChild("Humanoid") local animation = Tool["insert-2"] local animation2 = Tool["insert-1"] local AnimTrack = hum:LoadAnimation(script.Parent["insert-1"]) Tool.Activated:connect(function(mouse) animation2:Play() end) Tool.Unequipped:connect(function() animation2:Stop() end)
Animations do not have a method called Play, only the AnimationTracks which are returned after loading the animation on a humanoid.
Something like this should work:
Tool = script.Parent local player = game.Players.LocalPlayer local char = player.Character or player.CharacterAdded:Wait() local hum = char:WaitForChild("Humanoid") local animation = Tool["insert-2"] local animation2 = Tool["insert-1"] local AnimTrack2 = hum:LoadAnimation(animation2) Tool.Activated:connect(function(mouse) AnimTrack2:Play() end) Tool.Unequipped:connect(function() AnimTrack2:Stop() end)
If you also want to play the first animation, you will have to create a separate track for it. Also, make sure the AnimationPriority is action if the animation doesn't seem to work; you can do this by going:
AnimTrack2.Priority = Enum.AnimationPriority.Action
Hope this helps!