Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How could I make a leaning system?

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.

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)

1 comment

0

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

This discussion is preserved as it was. New answers, comments, and votes are closed.