Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why Won't this animation play?

Asked by 8 years ago

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.

01local tool = script.Parent
02 
03local animation = Instance.new("Animation")
04            animation.AnimationId = "https://www.roblox.com/ForceField-Animation-item?id=429484416&rbxp=13961515"
05 
06            local animtrack =nil
07            local canplay = true
08 
09 
10tool.Equipped:connect(function(mouse)
11    mouse.KeyDown:connect(function(key)
12        if
13            key =="q" then
14            function PlayForceAnim(Source)
15                if
View all 31 lines...

1 answer

Log in to vote
0
Answered by
Bertox 159
8 years ago

You have to write a . instead of :

1animtrack = player.Humanoid:LoadAnimation(animation)
Ad

Answer this question