Parellel_X

Reanimate

Aug 11th, 2020
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.41 KB | None | 0 0
  1. --[[
  2. Original creator might be: not sure
  3. Edit by: dak#1111
  4.  
  5. Made it less aids to read + some quality of life changes. :p
  6. (Who ever made this, for the love of god learn to not make spaghetti.)
  7. --]]
  8.  
  9. -- Variables and setting up the character
  10. local rs = game:GetService("RunService")
  11.  
  12. local plr = game:GetService("Players").LocalPlayer
  13. local char = plr.Character
  14. char.Archivable = true
  15. local cam = workspace:WaitForChild("Camera")
  16.  
  17. local fakechar = char:Clone()
  18. fakechar.Head.face.Texture = ""
  19. fakechar.Parent = workspace
  20. cam.CameraSubject = fakechar:FindFirstChildOfClass("Humanoid")
  21.  
  22. local connections = {}
  23. local kill = false
  24.  
  25. -- Align function
  26. local function Align(Part1, Part0, Position, Angle)
  27. Part1.CanCollide = false
  28.  
  29. local AlignPos = Instance.new("AlignPosition")
  30. AlignPos.ApplyAtCenterOfMass = true
  31. AlignPos.MaxForce = 100000
  32. AlignPos.MaxVelocity = math.huge
  33. AlignPos.ReactionForceEnabled = false
  34. AlignPos.Responsiveness = 200
  35. AlignPos.RigidityEnabled = false
  36. AlignPos.Parent = Part1
  37.  
  38. local AlignOri = Instance.new("AlignOrientation")
  39. AlignOri.MaxAngularVelocity = math.huge
  40. AlignOri.MaxTorque = 100000
  41. AlignOri.PrimaryAxisOnly = false
  42. AlignOri.ReactionTorqueEnabled = false
  43. AlignOri.Responsiveness = 200
  44. AlignOri.RigidityEnabled = false
  45. AlignOri.Parent = Part1
  46.  
  47. local at1 = Instance.new("Attachment")
  48. at1.Parent = Part1
  49. local at2 = Instance.new("Attachment")
  50. at2.Parent = Part0
  51. at2.Orientation = Angle
  52. at2.Position = Position
  53.  
  54. AlignPos.Attachment0 = at1
  55. AlignPos.Attachment1 = at2
  56. AlignOri.Attachment0 = at1
  57. AlignOri.Attachment1 = at2
  58. end
  59.  
  60. local success, fail = pcall(function()
  61. -- Make the fake character invisible
  62. for _,v in pairs(fakechar:GetDescendants()) do
  63. if v:IsA("Part") then
  64. v.Transparency = 1
  65. elseif v:IsA("SpecialMesh") then
  66. v.MeshId = "rbxassetid://0"
  67. end
  68. end
  69.  
  70. -- Networking
  71. spawn(function()
  72. while rs.Stepped:wait() and not kill do
  73. settings().Physics.AllowSleep = false
  74.  
  75. sethiddenproperty(plr, "MaximumSimulationRadius", math.pow(math.huge,math.huge) * math.huge)
  76. sethiddenproperty(plr, "SimulationRadius", math.pow(math.huge,math.huge) * math.huge)
  77. end
  78. end)
  79.  
  80. -- Noclipping
  81. table.insert(connections, rs.Stepped:Connect(function()
  82. fakechar:FindFirstChild("Head").CanCollide = false
  83. fakechar:FindFirstChild("Torso").CanCollide = false
  84. char.Head.CanCollide = false
  85. char.Torso.CanCollide = false
  86. end))
  87. table.insert(connections, rs.Heartbeat:Connect(function()
  88. fakechar:FindFirstChild("Head").CanCollide = false
  89. fakechar:FindFirstChild("Torso").CanCollide = false
  90. char.Head.CanCollide = false
  91. char.Torso.CanCollide = false
  92. end))
  93. table.insert(connections, rs.RenderStepped:Connect(function()
  94. fakechar:FindFirstChild("Head").CanCollide = false
  95. fakechar:FindFirstChild("Torso").CanCollide = false
  96. char.Head.CanCollide = false
  97. char.Torso.CanCollide = false
  98. end))
  99.  
  100. -- Rigging
  101. char.Torso["Right Shoulder"]:Destroy()
  102. char.Torso["Left Shoulder"]:Destroy()
  103. char.Torso["Right Hip"]:Destroy()
  104. char.Torso["Left Hip"]:Destroy()
  105. char.HumanoidRootPart["RootJoint"]:Destroy()
  106. char.HumanoidRootPart.Anchored = true
  107. char.Humanoid.PlatformStand = true
  108. fakechar["Torso"].Position = char["Torso"].Position
  109.  
  110. -- Align
  111. for _,v in pairs(char:GetChildren()) do
  112. if v:IsA("Part") and v.Name ~= "Head" then
  113. if v.Name == "Torso" then
  114. Align(char[v.Name], fakechar[v.Name], Vector3.new(0,0.5,0),Vector3.new(0,0,0))
  115. else
  116. Align(char[v.Name], fakechar[v.Name], Vector3.new(0,0,0),Vector3.new(0,0,0))
  117. end
  118. end
  119. end
  120. end)
  121. if fail then
  122. warn(fail)
  123. plr.Character = char
  124. char:BreakJoints()
  125. fakechar:Destroy()
  126.  
  127. kill = true
  128. return
  129. end
  130.  
  131. -- Cleanup
  132. fakechar.Humanoid.Died:Connect(function()
  133. plr.Character = char
  134. char:BreakJoints()
  135. fakechar:Destroy()
  136.  
  137. kill = true
  138.  
  139. for _,v in pairs(connections) do v:Disconnect() end
  140. end)
  141. char.Humanoid.Died:Connect(function()
  142. plr.Character = char
  143. char:BreakJoints()
  144. fakechar:Destroy()
  145.  
  146. kill = true
  147.  
  148. for _,v in pairs(connections) do v:Disconnect() end
  149. end)
  150.  
  151. plr.Character = fakechar
Add Comment
Please, Sign In to add comment