What I'm trying to do is make it to where if I press "E" Or "Q" then my character leans. I already know the UserInputService stuff, I just need to know how I could make my character's head lean.
✓ ANSWER ACCEPTED
How could I make a leaning system?
1 answer
✓ Accepted answer
You can make it so when you press "E" or "Q" it plays an animation. This is on a local script, and I would put it in StarterPack
local UIS = game:GetService("UserInputService")
local debounce = false
local cooldown = (add how long your cooldown would be ex: 5)
local Character = Player.CharacterAdded:Wait()
local humanoid = Character:WaitForChild("Humanoid")
local animation = workspace.Animation --put your animation in the workspace, make sure its named Animation
animation.AnimationId = "http://www.roblox.com/asset/?id=insertAnimationIdHere"
local animationTrack = humanoid:LoadAnimation(animation)
UIS.InputBegan:Connect(function(input,isTyping)
if isTyping then
return
elseif input.KeyCode == Enum.KeyCode.Q then
if debounce == false then
animationTrack:Play()
debounce = true
wait(cooldown)
debounce = false
end
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
animation would be your character going into the lean. Make sure its on action, and its looped, so it wont end. BTW this is only to go into the lean. Im not sure how you would get out of it, but Im pretty sure you can just add another elseif statement, making the animation stop