Issue with orientation when cloned part to a tool

I’m not familiar with managing CFrames and their orientation, hence, I’ve came across an issue that sets a part's CFrame to the tool’s Handle CFrame, but doesn’t process part's orientation and is set by Handle.

Showcase of the issue:

The part, which is the cloned pepperoni, has an orientation of -90 at Z axis, which is then overlapped by the Handle's CFrame. I don’t know how to work around this. The orientation is basically then set to 0 when it’s meant to be -90.

clone.CFrame = handle.CFrame --issue here
clone.Anchored = false
local wc ="WeldConstraint"); wc.Parent = clone
wc.Part0 = clone; wc.Part1 = handle


You can modify the CFrame using operators.

clone.CFrame = handle.CFrame * CFrame.fromAxisAngle(0,0,90)

When you get a CFrame, it’ll copy ever aspect of it. But you can essentially offset from it using multiplication. I would recommend looking more into CFrames if you want to learn more. It’s not as complicated as it might seem, far from it.

Thank you for the response, however, the operation doesn’t seem to work as intended. I’ve read the documentation about CFrame.fromAxisAngle() and it seemed like it required a vector and such.

I managed to develop an understanding of CFrame angles how they worked, and

clone.CFrame = handle.CFrame * CFrame.Angles(0, 0, math.rad(-90))

worked for me.

There was an error regarding unable to cast double to Vector3, so I already knew that would malfunction.

Ah, I wasn’t to sure which one dealt with radians. I always wrote my own function:

function ang(x,y,z)
	x,y,z = x or 0, y or 0, z or 0
	return CFrame.Angles(math.rad(x),math.rad(y),math.rad(z))
1 Like