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

How do i make animation function when i Click a button?

Asked by
Tizzel40 243 Moderation Voter
6 years ago

Hey I Made an Emote gui and it has buttons like "wave" and "dace4".But when I press it nothing happens. How do I make an animation play when I click the button?

1 answer

Log in to vote
0
Answered by 6 years ago
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local humanoid = Character:WaitForChild("Humanoid")
local anim = Instance.new("Animation", humanoid)

anim.AnimationId = "http://www.roblox.com/asset/?id=01468567293" --Your animation id

script.Parent.MouseButton1Click:Connect(function(key)
        local animTrack = humanoid:LoadAnimation(anim)
        animTrack:Play()
end)

I hadn't tested but it should work, make in inside of a text button and use local script.

0
thx Tizzel40 243 — 6y
Ad

Answer this question