local button = script.Parent
local user = game.Players.LocalPlayer
local char = user.Character
local humanoid = char.Humanoid
local anim = humanoid:LoadAnimation(button.Anim)
function action()
anim:Play()
wait(1)
anim:Stop()
end
button.MouseButton1Down:connect(action)
✓ ANSWER ACCEPTED
Why won't this animation gui work?
1 answer
✓ Accepted answer
Wait for the Character object, Humanoid, and the animation object!
local button = script.Parent
local user = game.Players.LocalPlayer
local char = user.Character or user.CharacterAdded:wait()
local humanoid = char:WaitForChild("Humanoid")
local anim = humanoid:LoadAnimation(button:WaitForChild("Anim"))
function action()
anim:Play()
wait(1)
anim:Stop()
end
button.MouseButton1Down:connect(action)
1 comment
0
It still doesn't work in-game...
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Be sure that this is a local script (it has to be, since you're using LocalPlayer) and it's parented in (or is a descendant of) StarterGui (or StarterPack).