For example, I've been trying to do a flip by pressing the letter "e" I truly don't know how to do this.
✓ ANSWER ACCEPTED
Help Me With Adding Animations To Key Events?
1 answer
✓ Accepted answer
All you have to do, using UserInputService, is to bind a certain key, to process and handle the animation.
local player = game:GetService("Players").LocalPlayer
local uis = game:GetService("UserInputService")
local key = "E" -- key to bind
local animation = Instance.new("Animation")
animation.AnimationId = "animation asset id"
local character = player.Character or player.CharacterAdded:wait()
uis.InputBegan:connect(function(inputObject, processed)
if not processed then
if inputObject.KeyCode == Enum.KeyCode[key] then
local humanoid = character.Humanoid
if humanoid then
local track = humanoid:LoadAnimation(animation)
track:Play()
end
end
end
end)
EDIT the second parameter to the InputBegan event, gameProcessedEvent, is a boolean value that is set to true if the game itself is processing the input... (ie: chatting).
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Thanks you Soooo Much But it says " play is not a valid member of AnimationTrack" What Do I do?
right, it should be "Play".. instead of "play".
Thank you So Much!