So when I press a key I want to run an animation. I don't know how to use user input service and how to use it with an animation. I have one more question if I hold the key will the animation will stop at the last frame of the animation or it will loop the animation?
game:GetService("UserInputService").InputBegan:connect(function(Key, Chat) if Key.KeyCode = Enum.KeyCode.Q and not Chat then -- This makes it so when you push Q, and you're not typing in the chat, the animation will play AnimTrack:Play() end end) -- Only add this next part if you want the animation to stop when you release the key --[[ game:GetService("UserInputService").InputEnded:connect(function(Key, Chat) if Key.KeyCode = Enum.KeyCode.Q and not Chat then -- This makes it so when you release Q, and you're not typing in the chat, the animation will stop AnimTrack:Stop() end end) ]]--
local UIS = game:GetService("UserInputService") UIS.InputBegan:connect(function(key) if key.KeyCode == Enum.KeyCode.E then animationTrack:Play() end end)