Advertisement
HowAreYu

oringal converter

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