Mryeetmemes

BackupWeld

Dec 9th, 2021
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | None | 0 0
  1. function Weld(x,y)
  2.     local W = Instance.new("Weld")
  3.     W.Part0 = x
  4.     W.Part1 = y
  5.     local CJ = CFrame.new(x.Position)
  6.     local C0 = x.CFrame:inverse()*CJ
  7.     local C1 = y.CFrame:inverse()*CJ
  8.     W.C0 = C0
  9.     W.C1 = C1
  10.     W.Parent = x
  11. end
  12.  
  13. function Get(A)
  14.     if A.className == "Part" then
  15.         Weld(script.Parent.Handle, A)
  16.         A.Anchored = false
  17.     else
  18.         local C = A:GetChildren()
  19.         for i=1, #C do
  20.         Get(C[i])
  21.         end
  22.     end
  23. end
  24.  
  25. function Finale()
  26.     Get(script.Parent)
  27. end
  28.  
  29. script.Parent.Equipped:connect(Finale)
  30. script.Parent.Unequipped:connect(Finale)
  31. Finale()
Advertisement
Add Comment
Please, Sign In to add comment