Advertisement
Guest User

Breaking-Merc

a guest
Jan 17th, 2019
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.42 KB | None | 0 0
  1. --[[
  2.     UserMorph: Folder
  3.     |_> Middle: Positioned Union
  4. ]]
  5. local function MorphUser(User,Team,Class,Morph,name)
  6.     local MorphRoot = Morphs[Team][Class]:WaitForChild(Morph)                  
  7.     for _,v in pairs(User.Character:GetChildren()) do
  8.         if v.Name == name then
  9.             v:Destroy()
  10.         end
  11.     end
  12.     local UserMorph = MorphRoot:Clone()
  13.     UserMorph.Parent = User.Character
  14.     UserMorph.Name = name
  15.     if UserMorph:FindFirstChild('Shirt') then
  16.         if User.Character:FindFirstChild('Shirt') then
  17.             User.Character.Shirt:remove()
  18.             UserMorph.Shirt.Parent = User.Character
  19.         end
  20.     end
  21.     if UserMorph:FindFirstChild('Pants') then
  22.         if User.Character:FindFirstChild('Pants') then
  23.             User.Character.Pants:remove()
  24.             UserMorph.Pants.Parent = User.Character
  25.         end
  26.     end
  27.     for _,u in ipairs(UserMorph:GetChildren()) do
  28.         if u.Name ~= 'Shirt' and u.Name ~= 'Pants' then
  29.             --u.Middle.Transparency = 1
  30.             for _,p in ipairs(u:GetChildren()) do
  31.                 if p:IsA("BasePart") then
  32.                     local W = Instance.new("Weld",u.Middle)
  33.                     W.Part0 = u.Middle
  34.                     W.Part1 = p
  35.                     local CJ = CFrame.new(u.Middle.Position)
  36.                     local C0 = u.Middle.CFrame:inverse()*CJ
  37.                     local C1 = p.CFrame:inverse()*CJ
  38.                     W.C0 = C0
  39.                     W.C1 = C1
  40.                 end
  41.                 local Y = Instance.new("Weld",p)
  42.                 Y.Part0 = User.Character:FindFirstChild(u.Name)
  43.                 Y.Part1 = u.Middle
  44.                 Y.C0 = CFrame.new(0, 0, 0)
  45.                 p.CanCollide = false
  46.                 p.Anchored = false
  47.             end
  48.         end
  49.     end
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement