Basically, I'm trying to make a script where the part is touched, an animation is played in the player. This is my code:
local s = script.Parent
local animation = s.Eating_anim
local Player = game.Players.LocalPlayer:WaitForChild("Character")
local animTrack = Player.Humanoid:LoadAnimation(animation)
script.Parent.ClickDetector.MouseClick:connect(function()
animTrack:Play()
end)
Apparently there is an error in line 3: Workspace.Part.Script> :3: attempt to index field 'LocalPlayer' (a nil value)>
Anyone knows what this means and how to solve the error?

5 comments
Thanks. There were no errors but the animation isn't being played. Do you know why?
I have done an edit, you can try the edits that i made.
It says the animation fails to load. The animation is mine and I have used everything you wrote.
Animation "1293869333" failed to load in "Workspace.Florian27.Animation.AnimationId": Animation failed to load
For me it worked. It may be a bug on Roblox's server/Roblox Studio. I will try to take a look on the script. Use YouTube tutorials to try to solve the problem.