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

Loss of legs after crouching, what is the problem?

Asked by 10 years ago

The script works but if you press the key to uncrouch, you will lose your legs. Any way to fix that? By the way, the script is a chunk of the main script which handles crouching. If you need to see the main script, just ask. Your legs do not come off, but go through the floor and you still have them but they're in the floor.

function Crouch()
    if sprinting.Value then
        ResetSprint()
    end 
    while crouching.Value do
        if player.Character.Humanoid.WalkSpeed == 16 then
            player.Character.Humanoid.WalkSpeed = 8
        end
        if player.Character.Torso.Velocity.magnitude > 3 then
            character.Animate.Disabled = true
            if not crouching.Value then break end
            ting = 0
            character.Torso:findFirstChild("Left Shoulder").DesiredAngle = -math.pi/4
            character.Torso:findFirstChild("Right Shoulder").DesiredAngle = -math.pi/4
            character.Torso:findFirstChild("Left Shoulder").MaxVelocity = 0.1
            character.Torso:findFirstChild("Right Shoulder").MaxVelocity = 0.1
            repeat
                if not crouching.Value then break end
                welds[1].C1 = (welds[1].C1+Vector3.new(0,-6/80,10/80))*CFrame.fromEulerAnglesXYZ(math.rad(10),0,0)
                welds[2].C1 = (welds[2].C1+Vector3.new(0,6/80,-10/80))*CFrame.fromEulerAnglesXYZ(math.rad(-10),0,0)
                ting = ting + 1
                if player.Character.Torso.Velocity.magnitude > 1 then
                    wait(1/15)
                else
                    wait()
                end 
            until ting == 8
            ting = 0
            character.Torso:findFirstChild("Left Shoulder").DesiredAngle = math.pi/4
            character.Torso:findFirstChild("Right Shoulder").DesiredAngle = math.pi/4
            character.Torso:findFirstChild("Left Shoulder").MaxVelocity = 0.1
            character.Torso:findFirstChild("Right Shoulder").MaxVelocity = 0.1
            repeat
                if not crouching.Value then break end
                welds[2].C1 = (welds[2].C1+Vector3.new(0,-6/80,10/80))*CFrame.fromEulerAnglesXYZ(math.rad(10),0,0)
                welds[1].C1 = (welds[1].C1+Vector3.new(0,6/80,-10/80))*CFrame.fromEulerAnglesXYZ(math.rad(-10),0,0)
                ting = ting + 1
                if player.Character.Torso.Velocity.magnitude > 3 then
                    wait(1/15)
                else
                    wait()
                end 
            until ting == 8
        else
            character.Animate.Disabled = false
        end
        wait()
    end
    character.Animate.Disabled = false
end 
0
Your welds are probably breaking somewhere. I'm not sure where, though. RedCombee 585 — 10y
0
Any cFrame experts out there? Ryan5124KBCP 15 — 10y

Answer this question