Advertisement
Guest User

ree

a guest
Feb 15th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.96 KB | None | 0 0
  1. function morph(plr, part, location, model, test)
  2.     if plr ~= nil then
  3.         if test == 'Morph' then
  4.             if plr:FindFirstChild('Morph') == nil then
  5.                 local Folder = Instance.new('Folder')
  6.                 Folder.Name = 'Morph'
  7.                 Folder.Parent = plr
  8.             end
  9.         elseif test == 'Coat' then
  10.             if plr:FindFirstChild('Coat') == nil then
  11.                 local Folder = Instance.new('Folder')
  12.                 Folder.Name = 'Coat'
  13.                 Folder.Parent = plr
  14.             end
  15.         elseif test == 'Add' then
  16.             if plr:FindFirstChild('Add') == nil then
  17.                 local Folder = Instance.new('Folder')
  18.                 Folder.Name = 'Add'
  19.                 Folder.Parent = plr
  20.             end
  21.         elseif test == 'Pauld' then
  22.             if plr:FindFirstChild('Pauld') == nil then
  23.                 local Folder = Instance.new('Folder')
  24.                 Folder.Name = 'Pauld'
  25.                 Folder.Parent = plr
  26.             end
  27.         end
  28.         local Folder = (test == 'Morph' and plr:FindFirstChild('Morph')
  29.              or test == 'Coat' and plr:FindFirstChild('Coat')
  30.              or test == 'Add' and plr:FindFirstChild('Add')
  31.              or test == 'Pauld' and plr:FindFirstChild('Pauld'))
  32.         if Folder:FindFirstChild(model) == nil then
  33.             local g = location[model]:Clone()
  34.             g.Parent = Folder
  35.             for i, v in ipairs(g:GetChildren()) do
  36.                 if v:IsA("BasePart") then
  37.                     local W = Instance.new("Weld")
  38.                     W.Part0 = g.Middle
  39.                     W.Part1 = v
  40.                     local CJ = CFrame.new(g.Middle.Position)
  41.                     local C0 = g.Middle.CFrame:inverse() * CJ
  42.                     local C1 = v.CFrame:inverse() * CJ
  43.                     W.C0 = C0
  44.                     W.C1 = C1
  45.                     W.Parent = g.Middle
  46.                 end
  47.                 local Y = Instance.new("Weld")
  48.                 Y.Part0 = plr:FindFirstChild(part)
  49.                 Y.Part1 = g.Middle
  50.                 Y.C0 = CFrame.new(0, 0, 0)
  51.                 Y.Parent = Y.Part0
  52.             end
  53.             local h = g:GetChildren()
  54.             for i = 1, # h do
  55.                 if h[i].className == "Part" or  h[i].className == "UnionOperation" or  h[i].className == "MeshPart" or  h[i].className == "WedgePart" then  
  56.                     h[i].Anchored = false
  57.                     h[i].CanCollide = false
  58.                 end
  59.             end
  60.         end
  61.     end
  62. end
  63. local function RunThings(char,Model, test)
  64.     pcall(function()
  65.         if Model:findFirstChild("Head") then
  66.             morph(char, 'Head', Model, "Head",test)
  67.             --char.Head.face:remove()
  68.             --char.Head.Transparency = 1
  69.         end
  70.         if Model:findFirstChild("UpperTorso") then
  71.             morph(char, 'UpperTorso', Model, "UpperTorso",test)
  72.         end
  73.         if Model:findFirstChild("LowerTorso") then
  74.             morph(char, 'LowerTorso', Model, "LowerTorso",test)
  75.         end
  76.         if Model:findFirstChild("LeftUpperArm") then
  77.             morph(char, 'LeftUpperArm', Model, "LeftUpperArm",test)
  78.         end
  79.         if Model:findFirstChild("RightUpperArm") then
  80.             morph(char, 'RightUpperArm', Model, "RightUpperArm",test)
  81.         end
  82.         if Model:findFirstChild("LeftLowerArm") then
  83.             morph(char, 'LeftLowerArm', Model, "LeftLowerArm",test)
  84.         end
  85.         if Model:findFirstChild("RightLowerArm") then
  86.             morph(char, 'RightLowerArm', Model, "RightLowerArm",test)
  87.         end
  88.         if Model:findFirstChild("LeftHand") then
  89.             morph(char, 'LeftHand', Model, "LeftHand",test)
  90.         end
  91.         if Model:findFirstChild("RightHand") then
  92.             morph(char, 'RightHand', Model, "RightHand",test)
  93.         end
  94.         if Model:findFirstChild("LeftUpperLeg") then
  95.             morph(char, 'LeftUpperLeg', Model, "LeftUpperLeg",test)
  96.         end
  97.         if Model:findFirstChild("RightUpperLeg") then
  98.             morph(char, 'RightUpperLeg', Model, "RightUpperLeg",test)
  99.         end
  100.         if Model:findFirstChild("LeftLowerLeg") then
  101.             morph(char, 'LeftLowerLeg', Model, "LeftLowerLeg",test)
  102.         end
  103.         if Model:findFirstChild("RightLowerLeg") then
  104.             morph(char, 'RightLowerLeg', Model, "RightLowerLeg",test)
  105.         end
  106.         if Model:findFirstChild("LeftFoot") then
  107.             morph(char, 'LeftFoot', Model, "LeftFoot",test)
  108.         end
  109.         if Model:findFirstChild("RightFoot") then
  110.             morph(char, 'RightFoot', Model, "RightFoot",test)
  111.         end
  112.     end)
  113. end
  114. --MorphUser(Player,"TFO","Heroes","Austin","Morph")
  115. --MorphUser(Player,"Addons","Addons","Coat","Coat")
  116. local function MorphUser(User,Team,Class,Morph,name)
  117.     local MorphRoot = Morphs[Team][Class]:WaitForChild(Morph)                  
  118.     local Model = MorphRoot:Clone()
  119.     local char = User.Character
  120.     RunThings(char,Model,name)
  121. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement