Hello!
If anyone here came accross a pretty frustrating issue, which is collision troubles with old UnionOperation , then you are certainly wondering if the union is not broken forever.
I have an answer for you: No, it is not !
How to fix them doesn’t require any special scripting talents.
It is recommended that you open the Output first, which will allow you to keep track of the operation status. (You can open it in VIEW → Output)
Here is the tool:
-- UnionOperation collision repairer --
-- Execute into Roblox Studio command line --
local descendants = game:GetDescendants()
local unions = {}
for _, v in ipairs(descendants) do
if v:IsA("UnionOperation") then
table.insert(unions, v)
end
end
for i = 1, #unions do
local v = unions[i]
local colFid = v.CollisionFidelity
v.CollisionFidelity = Enum.CollisionFidelity.PreciseConvexDecomposition
task.wait()
v.CollisionFidelity = Enum.CollisionFidelity.Default
task.wait()
v.CollisionFidelity = Enum.CollisionFidelity.Box
task.wait()
v.CollisionFidelity = Enum.CollisionFidelity.Hull
task.wait()
v.CollisionFidelity = colFid
print(v:GetFullName() .. " has been processed.")
print(math.floor(i / #unions * 100000) / 1000 .. "% done.")
print(#unions - i .. " unions remaining.")
end
print("Operation done !")
In this current configuration, the whole game will be scanned for UnionOperation to repair. If your game is really big, this might take a pretty long time.
If you want to change the path for searching unions, you have to edit the descendants property.
You are not familiar with coding ? Don’t worry, this is also a tutorial for builders, I will guide you through !
You have to touch this line, and more specificly, change the text game:
local descendants = game:GetDescendants()
Let’s say your folder containing, for example, a map, is in the workspace, and is called I am a box
Well, then the descendants line will be:
local descendants = game.Workspace["I am a box"]:GetDescendants()
But, what if the I am a box folder is inside another folder called Folder ? Ah! ?
Then, the descendants line will be:
local descendants = game.Workspace["Folder ? Ah!"]["I am a box"]:GetDescendants()
And now, if all of that is in ServerStorage or Lighting ?
Then:
local descendants = game.ServerStorage["Folder ? Ah!"]["I am a box"]:GetDescendants()
or
local descendants = game.Lighting["Folder ? Ah!"]["I am a box"]:GetDescendants()
I know that there are plenty of ways of doing this a way better, but I’m doing it simpler for those who don’t know how to script, feel obviously free to write your own descendants line
After the script is ran, it will display informations about the percentage done and the remaining amount of unions:
Once everything is done, you should see: Operation done !
If you see this, it is the time to Publish the game (You can also try only saving, but at your own risks, I have never tried this.)
I hope this tutorial is useful for anyone who uses old maps, or old models.
Have a nice day, people !