✓ Accepted answer
This should be a localscript
Well, there's nothing in particular wrong with your code, other than on line 3 when you wrote 'Humanoid'. So this would error if you haven't defined Humanoid yet. Also, for efficiency, create the animation outside the scope of the MouseButton1Click event. If it's inside, then each time you click the gui a new Animation object will be created. And you might also want to load the animation onto the Humanoid outside the scope of the MouseButton1ClickEvent
So, revised.. but you still have to define 'Humanoid'
local Humanoid
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID=4147090414"
local animTrack = Humanoid:LoadAnimation(animation)
script.Parent.MouseButton1Click:connect(function()
animTrack:Play()
end)
If you have trouble defining the Humanoid then either PM me on the site or tell me on here where this script is located.
1 comment
Thanks again!