World CFrame of Object CFrame not in correct position

  1. What do you want to achieve? Keep it simple and clear!
    This code would be run in the output, and should result in a new part having the same objectCFrame as the one above, but then converted into WorldSpace.
  2. What is the issue? Include screenshots / videos if possible!
    Currently the objectCFrame when converted into world space, results in a position and orientation that is much larger and is not what I intended. The new part should be in the same objectCFrame when converted to worldSpace, but it is not.



What should occur:

  1. What solutions have you tried so far?
    I’ve tried using motor6Ds, but they didn’t work. I also couldn’t find anything related to this problem on the devforum.

I got the ObjectCFrame from using StandardPositionPart.CFrame:ToObjectSpace(Collect.CFrame)
(Collect is the primary part). This StandardPositionPart listed above is in the correct objectSpace.

local objectCFrame = CFrame.new(-0.00105285645, -1.03900146, -0.0759925842, 2.77803757e-12, -0.666028321, 0.745929718, -1, -3.66942631e-12, 3.85741704e-13, 2.43879916e-12, -0.745930552, -0.666027546)-- object CFrame (intended pivot)

for _, descendant in pairs(game:GetDescendants()) do
	if descendant:IsA("Model") and descendant.Name == "Slot" then
		if not descendant:FindFirstChild("StandardPositionPart") then
			local new = Instance.new("Part")
			new.CFrame = objectCFrame:ToWorldSpace(descendant.Collect.CFrame)
			new.Name = "StandardPositionPart"
			new.Anchored = true
			new.Size = Vector3.new(0.2, 0.2, 0.2)
			new.Parent = descendant

		end
	end
end```

If collect is a primary part when you do .CFrame you will get the world space CFrame instead.

You can instead use an attachment.CFrame which is in object space relative to the part it is parented to.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.