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

How to fix gravity on welding(character)?

Asked by 8 years ago

I'm having issues with the gravity of the player when i weld its legs, it seems to be floating instead of sinking lower down to the ground. I tried moving the torso down a stud(i now realize even if that worked it would probably give me problems later on), yet that kills the player. Any help is appreciated, thanks! Crouch function, enabled by pressing c, is below.

function Crouch()

    if not Crouched then

        Crouched = true

        Humanoid.WalkSpeed = 10

        Torso.Position = Torso.Position - Vector3.new(0, 1, 0) -- Kills player .o.

        --Welds legs in crouch position, legs are repositioned a stud higher than before
        --player character does not drop back down to the ground
        local RLegWeld = Instance.new("Weld")
        RLegWeld.Parent = Torso
        RLegWeld.Part0 = Torso
        RLegWeld.Part1 = RLeg
        RLegWeld.C1 = CFrame.new(-.5,1,1) * CFrame.Angles(0,0,0)

        local LLegWeld = Instance.new("Weld")
        LLegWeld.Parent = Torso
        LLegWeld.Part0 = Torso
        LLegWeld.Part1 = LLeg
        LLegWeld.C1 = CFrame.new(.5,0.5,1.5) * CFrame.Angles(math.pi/2,0,0)

    end

end

Answer this question