Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Lerping Welds Problem?

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

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

2 comments

0

In what way

0

Well, the lerp function will return a CFrame. You need to use that CFrame in the script.

This discussion is preserved as it was. New answers, comments, and votes are closed.