#Animation on keypress

1 messages · Page 1 of 1 (latest)

severe frost
#

Hihi! I made an animation that I want to have run if the player presses E while sprinting (holding shift) and have looked everywhere I can but can't get anywhere with it so any help is appreciated 😭 the general aim is that if a player is sprinting and presses E while approaching another player or npc, it locks them both so they can't walk away or escape, and it plays a combo attack animation

teal mirage
#

check if the player is sprinting then whenever they press E make it play the animation using variables

local UIS = game:GetService("UserInputService")
local anim = animationhere

if input.KeyCode == Enum.Keycode.E then
  if sprinting then
    anim:Play()
  end
end
heavy matrix
#

like this:

local UIS = game:GetService("UserInputService")
local anim = animationhere

if input.KeyCode ~= Enum.Keycode.E or input.KeyCode ~= Enum.KeyCode.LeftShift then return end
  
anim:Play()
end