function onClicked(click) local animation = Instance.new("Animation") animation.AnimationId = "http://www.roblox.com/Asset?ID=144884906" end
Put this inside the button (it needs to be a localscript, or it won't work)
local player = game.Players.LocalPlayer repeat wait() until player.Character -- wait until their character exists local anim = Instance.new("Animation") -- make a new animation animation.AnimationId = "http://www.roblox.com/Asset?id=144884906" -- set the animation's id local animation = player.Character.Humanoid:LoadAnimation(anim) -- load the animation function onClicked() animation:Play() -- play the animation end script.Parent.MouseButton1Down:connect(onClicked)
P.S. Next time, put your code inside the code (~~~~~~~~~~~~~~~~~) tags.