Motor6D Manipulation Progress

Hi again,
I’ve recently made some progress with the local script, while I can’t switch the animations for some reason. It works at least.

Also the server-side script is empty for now.

Client:

local pose = “Standing”

task.wait(0.5)

local player = game:GetService(“Players”).LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()

local RunService = game:GetService(“RunService”)

local charParts = {
–Head = char:FindFirstChild(“Head”),
Torso = char:FindFirstChild(“Torso”),
–Arms = {
– LeftArm = char:FindFirstChild(“LeftArm”),
– RightArm = char:FindFirstChild(“RightArm”)
–},
–Legs = {
– LeftLeg = char:FindFirstChild(“LeftLeg”),
– RightLeg = char:FindFirstChild(“RightLeg”)
–},
HRP = char:FindFirstChild(“HumanoidRootPart”)
}

local Motor6DS = {
RootJoint = charParts.HRP:FindFirstChild(“RootJoint”),
Neck = charParts.Torso:FindFirstChild(“Neck”),
Shoulders = {
LeftShoulder = charParts.Torso:FindFirstChild(“Left Shoulder”),
RightShoulder = charParts.Torso:FindFirstChild(“Right Shoulder”)
},
Hips = {
LeftHip = charParts.Torso:FindFirstChild(“Left Hip”),
RightHip = charParts.Torso:FindFirstChild(“Right Hip”)
}
}

– States –
function onRunning(speed)
if speed > 0 then
pose = “Running”
else
pose = “Standing”
end
end

– Animations –
local function Move()
if pose == “Running” then
local rad = 0.75
local t = 8 * 1.25
local degree = 0
local degree2 = 0

	RunService.Stepped:Connect(function()
		degree += 1
		degree2 -= 1

		local rZ = math.sin(math.rad(degree) * t) * rad
		local rZ2 = math.sin(math.rad(degree2) * t) * rad
		local rZ3 = math.sin(math.rad(degree) * t) * rad / 6
		local rZ4 = math.sin(math.rad(degree2) * t) * rad / 6

		local rX = math.sin(math.rad(degree2) * (t * 2)) * rad / 12

		local cframe = CFrame.Angles(0,0,rZ)
		local cframe2 = CFrame.Angles(0,0,rZ2)
		local cframe3 = CFrame.Angles(0,0,rZ3)
		local cframe4 = CFrame.Angles(rX,0,rZ4)

		Motor6DS.Shoulders.LeftShoulder.Transform = cframe2
		Motor6DS.Shoulders.RightShoulder.Transform = cframe2
		Motor6DS.Hips.LeftHip.Transform = cframe
		Motor6DS.Hips.RightHip.Transform = cframe
		Motor6DS.RootJoint.Transform = cframe3
		Motor6DS.Neck.Transform = cframe4
	end)
else
	Motor6DS.Shoulders.LeftShoulder.Transform = CFrame.Angles(0,0,0)
	Motor6DS.Shoulders.RightShoulder.Transform = CFrame.Angles(0,0,0)
	Motor6DS.Hips.LeftHip.Transform = CFrame.Angles(0,0,0)
	Motor6DS.Hips.RightHip.Transform = CFrame.Angles(0,0,0)
	Motor6DS.RootJoint.Transform = CFrame.Angles(0,0,0)
	Motor6DS.Neck.Transform = CFrame.Angles(0,0,0)
end

end

char:WaitForChild(“Humanoid”).Running:Connect(function(speed)
onRunning(speed)
end)

while char.Parent~=nil do
task.wait(0.1)
Move()
end

I still don’t know how to format code in devforum lol.