I have made an animation of the player crawling, and it works, but I want it to: stop when I let go of the key (left control) work while I walk (so far when I'm holding control and start walking forward it just gets up) and pause when I'm not moving

I think I know what to do, but I don't know how to. I think I need to find how to detect a keyReleased, and I think I need to make the crawling the walking animation so I can crawl while moving forward.

this is the only script I've managed to make(Combining scripts together), and it has all the problems listed above: Help?


local player = game:GetService("Players").LocalPlayer

local character = player.Character or player.Character:Added()

local humanoid = character:WaitForChild("Humanoid")



local anim = Instance.new("Animation")

anim.AnimationId = "rbxassetid://2577749915" 



function playAnimation(Anim)

    local track = humanoid:LoadAnimation(Anim)

    track:Play()

end



game:GetService("UserInputService").InputBegan:connect(function(input ,proc)

    if not proc then

        if input.KeyCode == Enum.KeyCode.LeftControl then 
 humanoid.WalkSpeed = 10 
           playAnimation(anim) 

        end

    end

end)



2 comments

0

Thank you, but how do I add it? The link you sent me doesn't work.