I was given this code on the ROBLOX website to stop animations, but I want to connect it to a button. How do I do that?
Thanks for helping me in advance.
script.Parent.MouseButton1Click:connect(function() void Stop ( float fadeTime = 0.100000001 ) end) script.Parent.MouseButton1Click:connect()
local player = game.Players.LocalPlayer locla character = player.Character local humanoid = character.Humanoid --This part stops all currently playing aniamtions script.Parent.MouseButton1Click:Connect(function() local anims = humanoid:GetPlayingAnimationTracks() for i,v in pairs(anims) do v:Stop() end end) --This part stops a certain playing animation script.Parent.MouseButton1Click:Connect(function() local anims = humanoid:GetPlayingAnimationTracks() for i,v in pairs(anims) do if v.Name == "Anim" then v:Stop() end end end)
(not tested in studio)