Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
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.

4 comments

0

Thnxs

0

Didn't work

0

Where do I put the animation?

0

You don't put the animation anywhere.. it creates it for you.

This discussion is preserved as it was. New answers, comments, and votes are closed.