Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- UserMorph: Folder
- |_> Middle: Positioned Union
- ]]
- local function MorphUser(User,Team,Class,Morph,name)
- local MorphRoot = Morphs[Team][Class]:WaitForChild(Morph)
- for _,v in pairs(User.Character:GetChildren()) do
- if v.Name == name then
- v:Destroy()
- end
- end
- local UserMorph = MorphRoot:Clone()
- UserMorph.Parent = User.Character
- UserMorph.Name = name
- if UserMorph:FindFirstChild('Shirt') then
- if User.Character:FindFirstChild('Shirt') then
- User.Character.Shirt:remove()
- UserMorph.Shirt.Parent = User.Character
- end
- end
- if UserMorph:FindFirstChild('Pants') then
- if User.Character:FindFirstChild('Pants') then
- User.Character.Pants:remove()
- UserMorph.Pants.Parent = User.Character
- end
- end
- for _,u in ipairs(UserMorph:GetChildren()) do
- if u.Name ~= 'Shirt' and u.Name ~= 'Pants' then
- --u.Middle.Transparency = 1
- for _,p in ipairs(u:GetChildren()) do
- if p:IsA("BasePart") then
- local W = Instance.new("Weld",u.Middle)
- W.Part0 = u.Middle
- W.Part1 = p
- local CJ = CFrame.new(u.Middle.Position)
- local C0 = u.Middle.CFrame:inverse()*CJ
- local C1 = p.CFrame:inverse()*CJ
- W.C0 = C0
- W.C1 = C1
- end
- local Y = Instance.new("Weld",p)
- Y.Part0 = User.Character:FindFirstChild(u.Name)
- Y.Part1 = u.Middle
- Y.C0 = CFrame.new(0, 0, 0)
- p.CanCollide = false
- p.Anchored = false
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement