Moving unions causes them to break

Is there a specific way to move unions?

because currently when moving a union it breaks it. (Changing its cframe in a script).

these are the changes being done to it:


local surfaceCfgs = {
			Top    = {Offset = CFrame.new(0, CELL_SIZE.Y/2  - .5, 0), Angle =  CFrame.Angles(math.rad(90), 0, 0)* RelativeRotation},
			Bottom = {Offset = CFrame.new(0, -CELL_SIZE.Y/2  + .5, 0), Angle = CFrame.Angles(math.rad(90), 0, 0)* RelativeRotation},
			North  = {Offset = CFrame.new(0, 0, -CELL_SIZE.Z/2  + .5), Angle = CFrame.Angles(0, 0, 0)* RelativeRotation},
			South  = {Offset = CFrame.new(0, 0, CELL_SIZE.Z/2 - .5), Angle = CFrame.Angles(0, 0, 0)* RelativeRotation},
			East   = {Offset = CFrame.new(CELL_SIZE.X/2, 0, 0), Angle = CFrame.Angles(math.rad(0), math.rad(90), math.rad(0))* RelativeRotation},
			West   = {Offset = CFrame.new(-CELL_SIZE.X/2  + .5, 0, 0), Angle =  CFrame.Angles(math.rad(0), math.rad(90), math.rad(0))* RelativeRotation},
		}
-- the templates are unions
local template = if (state == "Solid") then SOLID_SURFACE_TEMPLATE else OPEN_SURFACE_TEMPLATE
local newSurface = template:Clone()
	
-- THIS LINE -- Causes all the issues, when removing it unions dont obviouslly move but they dont breal.
newSurface.CFrame = CFrame.new(cellCenterPos) * surfaceCfgs[name].Offset * surfaceCfgs[name].Angle

Unioning these new moved parts always cause errors. In play testing (manually) copying then going to non playtesting (Also manually) and then also unioning by BasePart:UnionAsync({Parts}) or with geometry service.

Where am I going wrong?

2 Likes

Creating a union gives you a new instance
You have to parent new instance and get rid of older ones https://create.roblox.com/docs/reference/engine/classes/BasePart#UnionAsync

3 Likes

that already happens. Everything is made and created and works flawless as of rn (assume everything to be working fine). It is just that one line of code (moving the union) that breaks everything.

ive tested all the code lines and its just the one i provided

that is causing the issue.

What is a surfaceCfgs?
You sure that it returns a CFrame?
Can you please provide an error message?

14:59:23.639 Something went wrong. CSG returned error code -6. Please file a bug report, preferably with a file containing the problematic object(s). - Studio

And yes it does. if it didnt it would also cause an error.

simply this line of code. When removed.

newSurface.CFrame = CFrame.new(cellCenterPos) * surfaceCfgs[name].Offset * surfaceCfgs[name].Angle

Doesnt break these newly made template unions, where break means non-unionable

local template = if (state == "Solid") then SOLID_SURFACE_TEMPLATE else OPEN_SURFACE_TEMPLATE
local newSurface = template:Clone()

However that line of code is literally the most important because it positions all the templates as needed. Which it does. But in return somehow breaks the union ability of the unions.

Maybe you need to parent it first?
It could be that property has metamethod that blocks it if its not in workspace maybe?

1 Like

even after all the templates have been made. Ive unioned them IN laytesting. Then even copied them OUTSIDE of playtesting and tried unioning them.

Then i even uploaded the templates as a model to a new workspace. And tried unioning there.

all fails, not to mention countless tries in scripts.

mb try using PivotTo?
Try waiting 1 second after parenting it to workspace idk

i used models too. none worked as well.

Im pretty sure that becouse surfaceCfgs[name].Offset does not return cframe.
What instance even is that?

Every thing as I said works fully. Plus it would make zero sense if it didn’t return a creamer cause that would 100% return an error. And as the unions are in the place there supposed to be as said.

And there all surfaces for a cube. I orientate some surfaces(unions) to a the surfaces of a cube. Then when all surfaces are made I wanna union them. But that’s the issue here. They won’t.

Please provide the code you are using for unioning.
You gave only information regarding cframes (and still without context) and nothing more.
I cant guess the issue without having any ground to build reasonable theories.

does it even matter if it doesnt work with unioning manually. as in selecting both unions and pressing Ctrl + Shift + G.

Im confused about what you are talking about :skull:
Are you talking about real time CGI UnionOperation or pre made ones? :skull: