I want this script to work, and print(“Works”).
There are No errors, and. this is on a server script
My script is larger than this, but i pinpointed it to here.
print(part,part.Parent)--this works
local TouchedPart = part --this works
local DrillUnion = {script.Parent.Union}--this works
local Newunion = TouchedPart:SubtractAsync(DrillUnion)--this doesn't work.
print("Works")
SubtractAsync creates a new union with a parent set to nil iirc, so right after you use SubtractAsync you should do:
Newunion.Parent = game.Workspace
Also, by using the method, the original parts are not deleted, so it’s possible the the parts are simply just covering up the union and you just have to delete the original parts after calling SubractAsync
Honestly, I think my fixed code was close to the same original script. Sometimes it seems that Roblox’s services don’t load something, then I rearange the code and it works perfectly, even thought it is the same exact thing.
print(part,part.Parent)--this works
local TouchedPart = part --this works
local DrillUnion = {script.Parent.Union}--this works
local Newunion = TouchedPart:SubtractAsync(DrillUnion)--this doesn't work.
print("Works")
turned into
print(part,part.Parent)--this works
local TouchedPart = part --this works
local DrillUnion = {script.Parent.Union}--this works
local Newunion = TouchedPart:SubtractAsync(DrillUnion)--this DOES work.
print("Works")
They are the same. I’m not sure why, or if this was the issue, but just rearranging the code worked for me. It probably had something to do with the timing, maybe add a wait() or something before you subtract the parts.