I'm scripting a game, and I'm using Motor6D to animate things. What is the best way to do this?

local Services =
{
	PLS = game:GetService("Players");
	RS = game:GetService("RunService")
};
local Player = Services.PLS.LocalPlayer;
local Mouse = Player:GetMouse();
local Char = Player.Character;
local RightUpperArm = Char:WaitForChild("RightUpperArm");
local RightShoulder = RightUpperArm:WaitForChild("RightShoulder");
local HumanoidRootPart =Char:WaitForChild("HumanoidRootPart");

Services.RS.Stepped:Connect(function()
	local Direction = Mouse.Hit.p+(Mouse.Hit.lookVector*5000);
	
	local RCF = HumanoidRootPart.CFrame;
	local ROFF = (RCF-RCF.p):Inverse();
	
		RightShoulder.Transform = ROFF*CFrame.new(Vector3.new(0, 0, 0), Direction)*CFrame.Angles(math.pi/2, 0, 0);
end);

2 comments

0

im so curuios......what does line 17 and 18 do?

0

It returns the inverse of CFrame.