Advertisement
SmokeDelsin

clone works

May 13th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. local D = false
  2. function onTouch(hit)
  3. if D == false then
  4. D = true
  5. if hit.Parent:findFirstChild("Humanoid") ~= nil then
  6. if hit.Parent:findFirstChild("Humanoid").Health > 0 then
  7. local P = hit.Parent:GetChildren()
  8. local M = Instance.new("Model")
  9. local H = Instance.new("Humanoid")
  10. M.Parent = game.Workspace
  11. M.Name = hit.Parent.Name
  12. if hit.Parent:findFirstChild("Pants") ~= nil then
  13. hit.Parent.Pants.Parent = M
  14. end
  15. if hit.Parent:findFirstChild("Shirt") ~= nil then
  16. hit.Parent.Shirt.Parent = M
  17. end
  18. for i=1, #P do
  19. if P[i].className == "Part" then
  20. local C = P[i]:clone()
  21. C.Parent = M
  22. C.Locked = false
  23. C.CanCollide = true
  24. P[i]:remove()
  25. end
  26. if P[i].className == "Hat" then
  27. P[i].Parent = M
  28. end
  29. end
  30. M:MoveTo(Vector3.new(8, 6, -1))
  31. M:MakeJoints()
  32. local P = M:GetChildren()
  33. for i=1, #P do
  34. if P[i].Name ~= "Torso" and P[i].Name ~= "Pants" and P[i].Name ~= "Shirt" and P[i].className ~= "Hat" then
  35. Weld(M.Torso,P[i])
  36. end
  37. if P[i].className == "Hat" then
  38. Weld(M.Torso,P[i].Handle)
  39. end
  40. end
  41. H.Parent = M
  42. end
  43. end
  44. wait(2)
  45. D = false
  46. end
  47. end
  48. mouse.KeyDown:connect(function(key)
  49. print("Key Pressed : "..key)
  50. if key == "e" then
  51. function Weld(x,y)
  52. local W = Instance.new("Weld")
  53. W.Part0 = x
  54. W.Part1 = y
  55. local CJ = CFrame.new(x.Position)
  56. local C0 = x.CFrame:inverse()*CJ
  57. local C1 = y.CFrame:inverse()*CJ
  58. W.C0 = C0
  59. W.C1 = C1
  60. W.Parent = x
  61. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement