Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- location: Parent of Part morphing
- Folder: Folder holding morph parts on character
- ]]
- function morph(plr, part, location, model, test)
- if plr ~= nil then
- if test == 'Morph' then
- if plr:FindFirstChild('Morph') == nil then
- local Folder = Instance.new('Folder')
- Folder.Name = 'Morph'
- Folder.Parent = plr
- end
- elseif test == 'Coat' then
- if plr:FindFirstChild('Coat') == nil then
- local Folder = Instance.new('Folder')
- Folder.Name = 'Coat'
- Folder.Parent = plr
- end
- elseif test == 'Add' then
- if plr:FindFirstChild('Add') == nil then
- local Folder = Instance.new('Folder')
- Folder.Name = 'Add'
- Folder.Parent = plr
- end
- elseif test == 'Pauld' then
- if plr:FindFirstChild('Pauld') == nil then
- local Folder = Instance.new('Folder')
- Folder.Name = 'Pauld'
- Folder.Parent = plr
- end
- end
- local Folder = (test == 'Morph' and plr:FindFirstChild('Morph')
- or test == 'Coat' and plr:FindFirstChild('Coat')
- or test == 'Add' and plr:FindFirstChild('Add')
- or test == 'Pauld' and plr:FindFirstChild('Pauld'))
- if Folder:FindFirstChild(model) == nil then
- local g = location[model]:Clone()
- g.Parent = Folder
- for i, v in ipairs(g:GetChildren()) do
- if v:IsA("BasePart") then
- local W = Instance.new("Weld")
- W.Part0 = g.Middle
- W.Part1 = v
- local CJ = CFrame.new(g.Middle.Position)
- local C0 = g.Middle.CFrame:inverse() * CJ
- local C1 = v.CFrame:inverse() * CJ
- W.C0 = C0
- W.C1 = C1
- W.Parent = g.Middle
- end
- local Y = Instance.new("Weld")
- Y.Part0 = plr:FindFirstChild(part)
- Y.Part1 = g.Middle
- Y.C0 = CFrame.new(0, 0, 0)
- Y.Parent = Y.Part0
- end
- local h = g:GetChildren()
- for i = 1, # h do
- if h[i].className == "Part" or h[i].className == "UnionOperation" or h[i].className == "MeshPart" or h[i].className == "WedgePart" then
- h[i].Anchored = false
- h[i].CanCollide = false
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement