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

How to make player animations with CFraming?

I've never tried making player animations before, but I am trying to make a "basketball shooting" animation. How do you make the joints in players move to manipulate the appendages' rotations?

1 answer

✓ Accepted answer

Short Answer: You have to edit the C0 and C1 properties of the welds with a script

Long Answer: Welds have a C0 and C1 property. The C0 property determines the offset between the Part0 and Part1 of the Weld (Weld.Part0.CFrame * Weld.C0 = Weld.Part1.CFrame). The C1 property determines the offset between the Part1 and Part0 (Weld.Part1.CFrame * Weld.C1 = Weld.Part0.CFrame). That's a quick lesson on what the C0 and C1 properties of welds actually are.

Now to edit them, you need to use a script:

local Weld = INSERT_WELD_HERE

for Y = 0, 5, 0.1 do --This loop right here moves the C0 of a weld from (0, 0, 0) to (0, 5, 0) stepping by 0.1
	Weld.C0 = CFrame.new(0, Y, 0)
	wait()
end

That script will move the parts 5 studs apart in the Y direction. For more complex movements, you'll have to use angles to, like so:

local Weld = INSERT_WELD_HERE

for Y = 0, 5, 0.1 do --This loop right here moves the C0 of a weld from (0, 0, 0) to (0, 5, 0) stepping by 0.1
	Weld.C0 = CFrame.new(0, Y, 0) * CFrame.Angles(0, math.rad(Y), 0)
	wait()
end

This script will move the parts 5 studs apart but will also offset a part by an angle of 5 degrees in the Y axis of rotation. To do what you want to do, you'll need multiple loops controlling different parts of the weld components. Good luck

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