Need help with CFrame

My goal is to weld a gun to the character torso, I’ve tried tweening and playing with all the CFrame properties and welds but It still didnt work out.

Here’s what I want to achieve
2

But I got this instead
1

Basically, when player unequipped the gun all the BaseParts/MeshParts are clone (also Welded to the Handle) and grouped inside a Folder(CloneTool).

	local Handle	= CloneTool:FindFirstChild('Handle')
	local Torso		= Character:FindFirstChild('Torso')
	
	Handle.CFrame	= Torso.CFrame * CFrame.new(1, -1, 1) * CFrame.Angles(math.rad(90), math.rad(90), math.rad(90))
	local Weld	= Instance.new('Weld')
	Weld.Part0	= Torso
	Weld.Part1	= Handle
	Weld.C0		= Weld.Part0.CFrame:Inverse()
	Weld.C1		= Weld.Part1.CFrame:Inverse()
	Weld.Parent	= CloneTool
	
	CloneTool.Parent	= Character

I’ve tried changing the value of CFrame.Angles(math.rad(90), math.rad(90), math.rad(90)) but the tool just rotates on the Y and Z axis and not X axis.

If anyone had any ideas for this problem, your help is very appreciate.

@12Strings Try using a Attachment

1 Like

Can you elaborate more about using Attachment?

A attachment position is relative to the position of its parent and same thing apply to orientation
.

I’ve test it out and its working!

3

	local Handle	= CloneTool:FindFirstChild('Handle')
	local Torso		= Character:FindFirstChild('Torso')
	local Att		= Instance.new('Attachment', Torso)
	Att.Position	= Vector3.new(0.7, -0.7, 0.6)
	Att.Orientation	= Vector3.new(-90, 90, 0)
	
	Handle.CFrame	= Att.WorldCFrame

I make the Handle CFramed to the Attachment

1 Like

Remember to mark his post as the solution.