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

Lerping Welds Problem?

Asked by 8 years ago
local function CreateWeld(parent, p0, p1, c0, c1)
    local x = Instance.new('Weld', parent)
    x.Part0 = p0
    x.Part1 = p1
    x.C0 = c0
    x.C1 = c1
end

c.Torso['Right Hip'].Part1 = nil
c.Torso['Left Hip'].Part1 = nil                 
local LCrouchWeld = CreateWeld(c.Torso, c.Torso, c['Right Leg'], CFrame.new(0, 0, 0), CFrame.new(0, 0, 0))
local RCrouchWeld = CreateWeld(c.Torso, c.Torso, c['Left Leg'], CFrame.new(0, 0, 0), CFrame.new(0, 0, 0))               
for i = 1, 10 do
    LCrouchWeld.C1:Lerp(gunmodule.Animations.Crouch[1], 0.1)
    RCrouchWeld.C1:Lerp(gunmodule.Animations.Crouch[2], 0.1)
end

c is character
gunmodule requires the module script

Modulescript

gunData.Animations = { -- Animations
    Crouch = { -- Crouch
        CFrame.new(0.5, 0.495, 1.25) * CFrame.Angles(math.rad(90), 0, 0), -- Left Leg Crouch Position
        CFrame.new(-0.5, 0.75, 1), -- Right Leg Crouch Position
        CFrame.new(0, -1.25, 0) * CFrame.Angles(0, 0, 0), -- Root Joint C0
        CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0), -- Root Joint C1  
    }
}

No output but Legs disappear

1 answer

Log in to vote
0
Answered by
Spectrobz 140
8 years ago
for i = 1, 10 do
    LCrouchWeld.C1 = CFrame.new(0, 0, 0):Lerp(gunmodule.Animations.Crouch[1], i / 10)
    RCrouchWeld.C1 = CFrame.new(0, 0, 0):Lerp(gunmodule.Animations.Crouch[2], i / 10)
end

This is probably what you wanna fix

0
In what way PureConcept 0 — 8y
0
Well, the lerp function will return a CFrame. You need to use that CFrame in the script. Spectrobz 140 — 8y
Ad

Answer this question