A few days ago I tried to script the animations using the tutorial on the internet and the animation didn’t work. Today I tried from scratch to try to program a script for punching. I ran into a problem again where the animation doesn’t start and I get errors. I checked if I have everything in the right place and I looked at a few Developer Hub topics that mention the punching script, I checked their code and it seemed like I did everything right.
Here is my code and the errors I am getting and also where my script and animation is located.
local player = game.Players.LocalPlayer local character = player.Character local UIS = game:GetService("UserInputService") local mouse = player:GetMouse() local animation = script.Animation UIS.InputBegan:Connect(function(input) local humanoid = character:WaitForChild("Humanoid") if input.UserInputType == Enum.UserInputType.MouseButton1 then local animationTrack = humanoid:WaitForChild("Animator"):LoadAnimation(animation) animationTrack:Play() end end)
Animation is not a valid member of LocalScript “Workspace.dodo64bit.LocalScript”