Key down animation script isn't working


Hey developers I have a question about a key down animation script. The animation is a front flip. I am trying to make it so when a player presses “r” on his or her keyboard it does the animation. I looked it up on You Tube and the script that is given in the video doesn’t work. I don’t know if it would effect anything that the game is saved to my desktop. Let me know a new way or how to fix it thanks! From John…

Animation link:


Replace line 7 with this

anim.AnimationId = "rbxassetid://2074693420"


Ok thanks!


You can also try other methods to achieve such goals by using services such as UserInputService and ContextActionService.


This service is slightly faster since it will fire only when the button you want is pressed, unlike UserInputService where it will check every input until it finds the input from the key that’s desired.

local CAS = game:GetService("ContextActionService")
local deb = false

local function Binding(name, state, obj)
    if not deb then
       if state == Enum.UserInputState.Begin then
          deb = true
         deb = false

CAS:BindAction("AnimationPlay (change this to anything)", Binding, false, Enum.KeyCode.R)


local UIS = game:GetService("UserInputService")

local function InputBegan(input, processed)
    if input == Enum.UserInputType.Keyboard then
       local key = input.KeyCode
       if key == "R" then


Only one key plays