I was looking around for this for a while. So basically, I want to know how to make unions in scripts, and I also want to use this in a possibly future game.
I attempted it with the devforum code but for some reason that actually gives an error. Anyone know how to use them in scripts correctly?
This was the devforum code:
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
(I did add the parts by the way.)
On line 9 and 10, you put 'otherPart' when you defined your variable as 'otherParts'. Maybe that's the problem?
It turns out ROBLOX themselves had a mistake I guess. It was actually the table's fault. Thanks for your help everyone!
Fixed:
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) do otherPart:Destroy() end -- Insert new union into workspace newUnion.Parent = workspace