Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Walking animation doesn't work when crouching?

Asked by
zomspi 541 Moderation Voter
1 year ago

This crouch script works quite well, although when I walk my legs do not move, I have tried to look for an answer and discovered that it was because in the animation the legs had a keyframe, they were bent. When I removed the keyframes the walking animation worked again. The issue is that the crouching looks really weird if I don't modify the legs, if I don't modify the legs it also means that the player is too big and cannot fit through the small gaps. I would really appreciate if someone could tell me how I can both change the leg rotation and keep the walking animation, or make another crouching walking animation idk, the script is below. Thanks!

local UIS = game:GetService("UserInputService")

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

local isCrouching = false

local IdleAnim

UIS.InputBegan:Connect(function(Input, Chatted)
    if not Chatted then 
        if Input.KeyCode == Enum.KeyCode.C then
            if isCrouching == false then
                print("Crouching")
                IdleAnim = Humanoid:LoadAnimation(script:WaitForChild("crouchingAnimation"))
                isCrouching = true
                IdleAnim:Play()
            else
                print("Not Crouching")
                isCrouching = false     
                IdleAnim:Stop()
            end
        end
                end

        end)


Answer this question