We use cookies on this site to enhance your user experience

Basic In-Game Union Operation

Basic In-Game Union Operation

Sep 07 2018, 12:47 PM PST

This example assumes there are three parts named Part1, Part2, and Part3 in the Workspace. It creates a union, destroys the original parts, then inserts the resulting UnionOperation.

local part = workspace.Part1
local otherParts = {workspace.Part2, workspace.Part3}

-- Perform union operation
local newUnion = part:UnionAsync(otherParts)

-- Destroy source parts
part:Destroy()
for _, otherPart in pairs(otherParts)
	otherPart:Destroy()
end

-- Insert new union into workspace
newUnion.Parent = workspace