function onClicked(click) local animation = Instance.new("Animation") animation.AnimationId = "http://www.roblox.com/Asset?ID=144884906" end
COMMUNITY QUESTION
Can somebody help? I want to make a GUI that when you click you do an animation.
1 answer
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.
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
Thnxs
Didn't work
Where do I put the animation?
You don't put the animation anywhere.. it creates it for you.