Why Won't this animation play?
I am trying to put a script inside a tool so whenever i press the button "q", the animation plays. I have a script creating a forcefield in another local script in the same tool, but i am putting the animation in it's own local script so i don't get confused with all of the code. The error in this code keep saying "Global 'PlayForceAnim' is only used in the enclosing function; consider changing it to local" I have looked up so many guides of animation in roblox, but the one on the roblox wiki had the same code, except it said "PlayShockAnim" where "PlayForceAnim" is in my code. Please Help.
01 | local tool = script.Parent |
03 | local animation = Instance.new( "Animation" ) |
10 | tool.Equipped:connect( function (mouse) |
11 | mouse.KeyDown:connect( function (key) |
14 | function PlayForceAnim(Source) |
17 | local player = game.Players.LocalPlayer.Character |
19 | animtrack = player.Humanoid.LoadAnimation(animation) |
20 | animtrack.keyFrameReached:connect( function (keyFrameName) |
22 | keyFrameName = = "ForceEnd" then |