Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local remove_hats = false
- local morph1 = script.Parent
- for i,v in next,morph1:GetChildren() do
- if v:IsA("Model") then
- Instance.new("Humanoid",v)
- if script.Parent.Clothing:FindFirstChildOfClass("Shirt") then
- script.Parent.Clothing:FindFirstChildOfClass("Shirt"):Clone().Parent = v
- end
- if script.Parent.Clothing:FindFirstChildOfClass("Pants") then
- script.Parent.Clothing:FindFirstChildOfClass("Pants"):Clone().Parent = v
- end
- if script.Parent.Clothing:FindFirstChildOfClass("ShirtGraphic") then
- script.Parent.Clothing:FindFirstChildOfClass("ShirtGraphic"):Clone().Parent = v
- end
- end
- end
- local function assign(c)
- local morph = script.Parent:Clone()
- local function assemble(m,p,n)
- for i,v in next,m:GetChildren() do
- if v:IsA("Model") then
- assemble(v,p,n)
- else
- if v:IsA("Humanoid") then
- v:Destroy()
- elseif v:IsA("Shirt") then
- v:Destroy()
- elseif v:IsA("Pants") then
- v:Destroy()
- elseif v:IsA("ShirtGraphic") then
- v:Destroy()
- else
- local weld = Instance.new("Weld")
- weld.Part0 = v
- weld.Part1 = p
- weld.C0 = v.CFrame:inverse()*p.CFrame
- weld.Parent = p
- v.Anchored = false
- v.CanCollide = false
- if v.Name == n then
- v.Transparency = 1
- end
- end
- end
- end
- end
- local function cmtp(m)
- assemble(m,m[m.Name],m.Name)
- local weld = Instance.new("Weld")
- weld.Part0 = c[m.Name]
- weld.Part1 = m[m.Name]
- weld.Parent = c[m.Name]
- m.Parent = c
- end
- for i,v in next,morph:GetChildren() do
- if v:IsA("Model") then
- cmtp(v)
- end
- end
- if script.Parent.Clothing:FindFirstChildOfClass("Shirt") then
- if c:FindFirstChildOfClass("Shirt") then
- c:FindFirstChildOfClass("Shirt"):Destroy()
- end
- script.Parent.Clothing:FindFirstChildOfClass("Shirt"):Clone().Parent = c
- end
- if script.Parent.Clothing:FindFirstChildOfClass("Pants") then
- if c:FindFirstChildOfClass("Pants") then
- c:FindFirstChildOfClass("Pants"):Destroy()
- end
- script.Parent.Clothing:FindFirstChildOfClass("Pants"):Clone().Parent = c
- end
- if script.Parent.Clothing:FindFirstChildOfClass("ShirtGraphic") then
- script.Parent.Clothing:FindFirstChildOfClass("ShirtGraphic"):Clone().Parent = c
- end
- if c:FindFirstChildOfClass("ShirtGraphic") then
- c:FindFirstChildOfClass("ShirtGraphic"):Destroy()
- end
- if remove_hats == true then
- for i,v in next,c:GetChildren() do
- if v:IsA("Accessory") then
- v:Destroy()
- end
- end
- end
- end
- local db = false
- script.Parent.Button.Touched:connect(function(hit)
- if game.Players:FindFirstChild(hit.Parent.Name) and db == false then
- db = true
- assign(hit.Parent)
- wait(5)
- db = false
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement