Animation Won't Play When The Mouse Clicks?
So I am creating a simulator and most people know that when you are holding the tool or weapon and you click it plays and animation and gives strength. I am not focusing on the strength yet but I just need help on the animation. So the tool I am using is a wand and when you are holding it and you click, the animation will play. Everything is fine except for the animation. The animation won't play. The AnimationId is correct and and the animation is not nil. Everything but the "AnimationIsNil" is printing. I have moved some lines to other places and it still does not work. If any of you have a solution please tell me.
This is a local script
in the StarterPlayerScripts
01 | local mouse = game.Players.LocalPlayer:GetMouse() |
02 | local Character = game.Players.LocalPlayer.Character |
03 | if not Character or not Character.Parent then |
04 | Character = game.Players.LocalPlayer.CharacterAdded:Wait() |
06 | local Humanoid = Character:WaitForChild( "Humanoid" ) |
07 | local Animator = Humanoid:WaitForChild( "Animator" ) |
08 | local WandMovement = Instance.new( "Animation" ) |
10 | local Tool = game.Players.LocalPlayer.Backpack:FindFirstChildWhichIsA( "Tool" ) |
12 | Tool.Equipped:Connect( function () |
13 | print ( "ToolEquippedFUnction" ) |
14 | mouse.Button 1 Down:Connect( function () |
15 | print ( "IntoMouseButtonFunction" ) |
16 | local WandMovementAnimationTrack = Animator:LoadAnimation(WandMovement) |
17 | WandMovementAnimationTrack:Play() |
18 | if WandMovementAnimationTrack = = nil then |
19 | print ( "animationtrackisnil" ) |
21 | print ( "AnimationIsNotNil" ) |
Thank you for reading!