astronaut32

revive

Nov 5th, 2016
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. Services = setmetatable({},{__index=function(s,r) return game:service(r) end})
  2. Player = Services.Players.LocalPlayer
  3. wait()script.Parent=nil
  4. BodyParts={}
  5. abs = function(int)
  6. if int < 0 then return -int else return int end
  7. end
  8. rad = function(deg)
  9. return deg * math.pi / 180
  10. end
  11. deg = function(rad)
  12. return rad * 180 / math.pi
  13. end
  14. dist = function(p1,p2)
  15. r,e = ypcall(function()
  16. p1 = p1.Position
  17. end)
  18. if not r then p1 = p1 end
  19. r,e = ypcall(function()
  20. p2 = p2.Position
  21. end)
  22. if not r then p1 = p1 end
  23. return math.sqrt( (p2.X-p1.X)^2 + (p2.Y-p1.Y)^2 + (p2.Z-p1.Z)^2 )
  24. end
  25.  
  26. function GetChar()
  27. return Player.Character
  28. end
  29. function GetHum()
  30. for i,v in pairs(GetChar():children'') do
  31. if v.ClassName == 'Humanoid' then
  32. return v
  33. end
  34. end
  35. end
  36.  
  37. function Died()
  38. for i,v in pairs(GetChar():children'') do
  39. if v.ClassName == 'Part' then
  40. table.insert(BodyParts,{v.CFrame,v})
  41. elseif v.ClassName == 'Hat' then
  42. v.Parent=workspace
  43. table.insert(BodyParts,{v.Handle.CFrame,v.Handle,1})
  44. end
  45. end
  46.  
  47. wait(3)
  48. for i,v in pairs(BodyParts) do
  49. v[2].Anchored=true
  50. if v[2].Name == 'Torso' then pos = v[1] end
  51. end
  52.  
  53. for i,v in pairs(BodyParts) do
  54. coroutine.resume(coroutine.create(function()
  55. repeat Services.RunService.Heartbeat:wait()
  56. v[2].CFrame = v[2].CFrame:lerp(v[1],.1)
  57. until dist(v[2],v[1]) < .05
  58. v[2].CFrame=v[1]
  59. end))
  60. end
  61. end
  62.  
  63. Player.CharacterAdded:connect(function(char)
  64. char:WaitForChild('Torso')
  65. for i,v in pairs(BodyParts) do
  66. if v[3] then
  67. v[2]:Remove()
  68. end
  69. end
  70. BodyParts={}
  71. char.Torso.CFrame=pos or CFrame.new(0,12,0)
  72. GetHum().Died:connect(Died)
  73. end)
  74. GetHum().Died:connect(Died)
  75. print'rannering'
Add Comment
Please, Sign In to add comment