Is there a way to separate a union back to its original state with a script?

I looked everywhere online and couldn’t find a way to do it.

1 Like

Try and create a clone with a script, have it stored in your ReplicatedStorage using .Parent, then when its ready to be used bring it back into your workspace.

Maybe I worded what I was talking about wrong. I’m trying to achieve what this button does, but inside of a script:
Screenshot 2022-12-31 222220

Sorry for the inconvenience, but here is an example of how you can use the Decompose method to separate a union back to its original state:

local unionPart = script.Parent -- the union part

-- Decompose the union into its original parts
local parts = unionPart :Decompose()

-- Iterate over the parts and reparent them to the union's parent
for _, part in ipairs(parts) do
    part.Parent = unionPart .Parent
end

-- Destroy the union object
unionPart :Destroy()

I’m getting an error telling me that “Decompose” is not a valid member of UnionOperation “Workspace.Tree”
I also checked the Documentation and there is no word of Decompose()

I think I used some random different coding language involved on this, but I did find a small fix.

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