How to animate Character with CFrames?

I am doing this for fun, I know that animation exists (obviously because I’m an animator) and I am trying to code CFrame animation for fun.

I’ve been struggling to do it since it won’t work or so.
There’s the code.

-- Tweenservice
local TweenService = game:GetService("TweenService")
local Info = TweenInfo.new(0.5,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut)

Tool.Activated:Connect(function()
	if swinging == false then
		swinging = true
		SwingSound:Play()
		local tween1 = TweenService:Create(RightArm,Info, {Orientation = Vector3.new(90,0,0)})
		tween1:Play()
		wait(0.5)
		local tween2 = TweenService:Create(RightArm,Info, {Orientation = Vector3.new(0,0,0)})
		tween2:Play()
		wait(3)
		swinging = false
	end
end)
2 Likes

(This for R6 btw)
Ok. So, you will have to do a teeny, little bit of the easy weld function in moon animator. Make a dummy.
First, bring the arm into the down (Finished swinging) position, and make a new Motor6D (Join in place) for it, with the torso part0, rarm part1.
Run this script in the cmd bar

print(theNewWeldThatYouJustMade.C1)

Make note of the 9 printed numbers, paste them somewhere.

Do same for the hold (90* rotated up) pos.

Now, simply

local TweenService = game:GetService("TweenService")
local Info = TweenInfo.new(0.5,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut)
local swinging = false
local plr = game:GetService("Players").LocalPlayer
local chr = plr.Character or plr.CharacterAdded:Wait()
local RightArm = chr["Torso"]["Right Shoulder"]
Tool.Activated:Connect(function()
	if swinging == false then
		swinging = true
		SwingSound:Play()
		local tween1 = TweenService:Create(RightArm,Info, {C1 = your 90* orientation C1})
		tween1:Play()
		wait(0.5)
		local tween2 = TweenService:Create(RightArm,Info, {C1 = your 0,0,0 orientation C1})
		tween2:Play()
		wait(3)
		swinging = false
	end
end)

When rotating and moving like in anim, always use C0 and C1 properties of BaseWeld (M6D, weld, glue) etc… to prevent anything happening, and then reset it

1 Like