Advertisement
yoyo74456

Untitled

Aug 26th, 2021
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. local Player = owner
  2. local Char = Player.Character
  3. local tweenService = game:GetService("TweenService")
  4. script.Parent = Player
  5.  
  6. Char.Archivable = true
  7. local Clone = Char:Clone()
  8. Char.Archivable = false
  9. Clone.Parent = nil
  10.  
  11. --Char:WaitForChild("Humanoid").Died:Connect(function()
  12. -- Char.Humanoid:Destroy()
  13. --end)
  14.  
  15. local LoopEvent = Instance.new("RemoteEvent")
  16. LoopEvent.Name = "LoopEvent"
  17. LoopEvent.Parent = NLS([==[
  18. Player = owner
  19. local mouse = Player:GetMouse()
  20. local Char = owner.Character
  21. local Refit = false
  22. local CanDo = true
  23.  
  24. local Follower = Instance.new("Part", workspace)
  25. Follower.Size = Vector3.new(2,2,2)
  26. Follower.CanCollide = false
  27. Follower.Transparency = 1
  28.  
  29. local Health = false
  30. local LoopEvent = script.LoopEvent
  31. game:GetService("RunService").RenderStepped:Connect(function()
  32. workspace.CurrentCamera.CameraSubject = owner.Character
  33. if owner.Character:FindFirstChild("Torso") then
  34. Follower.CFrame = owner.Character.Torso.CFrame
  35. RespawnPos = Follower.CFrame
  36. else
  37. Follower.CFrame = Follower.CFrame
  38. end
  39.  
  40. if owner.Character:FindFirstChild("Humanoid") then
  41. if owner.Character.Humanoid.Health <= 0 then
  42. owner.Character.Humanoid:Destroy()
  43. end
  44. end
  45.  
  46. if CanDo then
  47. AncestryFun()
  48. end
  49. end)
  50.  
  51. local LostLimb
  52. function AncestryFun()
  53. CanDo = false
  54. Refit = false
  55.  
  56. if LostLimb ~= nil then
  57. repeat wait() until owner.Character:FindFirstChild(LostLimb)
  58. end
  59.  
  60. for i,v in pairs(owner.Character:GetChildren()) do
  61. v.AncestryChanged:Connect(function(_, parent)
  62. if _.Name ~= owner.Character.Name then
  63. if not parent then
  64. LostLimb = _.Name
  65. if not Refit then
  66. Refit = true
  67. LoopEvent:FireServer(Refit, RespawnPos)
  68. CanDo = true
  69. end
  70. end
  71. end
  72. end)
  73. end
  74. end
  75.  
  76.  
  77. ]==],owner.PlayerGui)
  78.  
  79. LoopEvent.OnServerEvent:Connect(function(Plr, Refit, RespawnPos)
  80. Update(Refit, RespawnPos)
  81. end)
  82.  
  83. function Update(Refit, RespawnPos)
  84. if Refit == true then
  85. if workspace:FindFirstChild(owner.Character) ~= nil then
  86. PlayerReset()
  87. else
  88. PlayerReset(RespawnPos)
  89. end
  90. end
  91. end
  92.  
  93. function PlayerReset(Pos)
  94. Char = Clone:Clone()
  95. Player.Character = Char
  96. Char.Parent = workspace
  97. Char.Torso.CFrame = Pos
  98.  
  99. Char.Animate.Disabled = true
  100. wait()
  101. Char.Animate.Disabled = false
  102. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement