How Motor6D weapons work?

So I’ve been wondering on how to make Motor6D weapons. I do know that there is documentations and stuff but there is no explanation on how I could make player’s arms move to certain positions and make the player hold the weapon, in this case gun. Many new developers may not know where to start with those, so I would like to get some help on how would I able to script Motor6D animations with this gun.

Many free model guns have this

local RightArmPos = CFrame.new(-0.902175903, 0.295501232, -1.32277012, 1, 0, 0, 0, 1.19248806e-08, 1, 0, -1, 1.19248806e-08)
local LeftArmPos = CFrame.new(0.805950999, 0.654529691, -2.22835343, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098)
local GunPos = CFrame.new(0.284460306, -0.318524063, 1.06423128, 1, 0, 0, 0, -2.98023224e-08, -0.99999994, 0, 0.99999994, -2.98023224e-08)

This tell me 2 things. I need to have some CFrame values to know where my arm should go and the gun itself, not only that, it will be used in Motor6D thingy. But I don’t understand what those numbers mean at all, I know for sure that they correspond to position, lookvector and many others.

image

After setting those up, I’ve got the idea what does number create.

I modified them a little bit, and it looks like 2 hands holding a gun. Great. Since I know that, now I am wondering how I can set the Motor6D to do that.

I created R6 Dummy and I’ve made this script

local LeftArm = script.Parent.Torso["Left Shoulder"]
local RightArm = script.Parent.Torso["Right Shoulder"]

local CFrames = {
	Hold = {
		L = CFrame.new(-0.902175903, 0.295501232, -1.32277012, 1, 0, 0, 0, 1.19248806e-08, 1, 0, -1, 1.19248806e-08),
		R = CFrame.new(0.805950999, 0.654529691, -2.22835343, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098)
	}
}

LeftArm.C0 *= CFrames.Hold.L
RightArm.C0 *= CFrames.Hold.R

Why this doesn’t work was intended? Any ideas? I am new to Motor6D animations and I am trying to make a Motor6D gun from scratch.

If you’re planning to make a Motor6D weapon I suggest you take look at this tutorial made by Headstackk

Thanks I didn’t notice it! I will take a look at it.

1 Like