minimic2002

Roblox SubtractAsync and UnionAsync

Aug 28th, 2020 (edited)
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. -- Minis SubtractAsync
  2. -- https://devforum.roblox.com/t/new-roblox-in-game-csg-api-is-now-available/174085
  3.  
  4. function GetSub(Part,List)
  5. local Success = false
  6. while Success == false do
  7. local Sub = Part:SubtractAsync(List)
  8. if Sub == nil then
  9. -- It Hasnt worked
  10. print("Union is nil")
  11. else
  12. local Success = true
  13. return Sub
  14. end
  15. end
  16. end
  17.  
  18. function GetUnion(Part,List)
  19. local Success = false
  20. while Success == false do
  21. local Union = Part:UnionAsync(List)
  22. if Union == nil then
  23. -- It Hasnt worked
  24. print("Union is nil")
  25. else
  26. local Success = true
  27. return Union
  28. end
  29. wait(1)
  30. end
  31.  
  32. end
  33.  
  34. function ActualiseUnion(Part,List,Union)
  35. if Union == nil then
  36. -- An Error Has Occured
  37. else
  38. -- There is a Union
  39. -- Remove Subtracts
  40. for i = 1,#List do
  41. List[i]:Destroy()
  42. end
  43. -- Remove MainPart
  44. local Cf = Part.CFrame
  45. local P = Part.Parent
  46. Part:Destroy()
  47. -- Place Union
  48. Union.CFrame = Cf
  49. Union.Parent = P
  50. end
  51. end
  52.  
Add Comment
Please, Sign In to add comment