Advertisement
Gamerulexerul

Untitled

Mar 24th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.44 KB | None | 0 0
  1.  
  2. --Converted with ttyyuu12345's model to script plugin v4
  3. function sandbox(var,func)
  4. local env = getfenv(func)
  5. local newenv = setmetatable({},{
  6. __index = function(self,k)
  7. if k=="script" then
  8. return var
  9. else
  10. return env[k]
  11. end
  12. end,
  13. })
  14. setfenv(func,newenv)
  15. return func
  16. end
  17. cors = {}
  18. mas = Instance.new("Model",game:GetService("Lighting"))
  19. Model0 = Instance.new("Model")
  20. Part1 = Instance.new("Part")
  21. SpecialMesh2 = Instance.new("SpecialMesh")
  22. Script3 = Instance.new("Script")
  23. Part4 = Instance.new("Part")
  24. SpecialMesh5 = Instance.new("SpecialMesh")
  25. Script6 = Instance.new("Script")
  26. Script7 = Instance.new("Script")
  27. Model0.Name = "BlackHole"
  28. Model0.Parent = mas
  29. Part1.Name = "H"
  30. Part1.Parent = Model0
  31. Part1.Transparency = 0.0099999997764826
  32. Part1.Rotation = Vector3.new(0, 0, -69.2600021)
  33. Part1.Anchored = true
  34. Part1.CanCollide = false
  35. Part1.Locked = true
  36. Part1.FormFactor = Enum.FormFactor.Symmetric
  37. Part1.Size = Vector3.new(188.213287, 204.579666, 8.18318653)
  38. Part1.CFrame = CFrame.new(34.0215988, 174.028, -63.0916214, 0.354115248, 0.935203671, 0, -0.935203671, 0.354115248, 0, 0, 0, 1)
  39. Part1.BottomSurface = Enum.SurfaceType.Smooth
  40. Part1.TopSurface = Enum.SurfaceType.Smooth
  41. Part1.Position = Vector3.new(34.0215988, 174.028, -63.0916214)
  42. Part1.Orientation = Vector3.new(0, 0, -69.2600021)
  43. SpecialMesh2.Name = "planar1"
  44. SpecialMesh2.Parent = Part1
  45. SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=1185246"
  46. SpecialMesh2.Scale = Vector3.new(1636.63672, 1636.63672, 0)
  47. SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=21315275"
  48. SpecialMesh2.VertexColor = Vector3.new(0, 0, 0)
  49. SpecialMesh2.MeshType = Enum.MeshType.FileMesh
  50. SpecialMesh2.Scale = Vector3.new(1636.63672, 1636.63672, 0)
  51. Script3.Name = "spin"
  52. Script3.Parent = Part1
  53. table.insert(cors,sandbox(Script3,function()
  54. spinning = script.Parent
  55.  
  56. while true do
  57. spinning.CFrame = spinning.CFrame * CFrame.fromEulerAnglesXYZ(0, math.rad(0), 0.2)
  58. wait()
  59. end
  60.  
  61. end))
  62. Part4.Name = "H"
  63. Part4.Parent = Model0
  64. Part4.Transparency = 1
  65. Part4.Rotation = Vector3.new(-180, 0, 21.4099998)
  66. Part4.Anchored = true
  67. Part4.CanCollide = false
  68. Part4.Locked = true
  69. Part4.FormFactor = Enum.FormFactor.Symmetric
  70. Part4.Size = Vector3.new(188.213287, 204.579666, 8.18318653)
  71. Part4.CFrame = CFrame.new(34.0358353, 174.006821, -54.908371, 0.931013227, -0.365007758, 0, -0.365007788, -0.931013346, 0, 0, 0, -1)
  72. Part4.BottomSurface = Enum.SurfaceType.Smooth
  73. Part4.TopSurface = Enum.SurfaceType.Smooth
  74. Part4.Position = Vector3.new(34.0358353, 174.006821, -54.908371)
  75. Part4.Orientation = Vector3.new(0, 180, -158.589996)
  76. SpecialMesh5.Name = "planar1"
  77. SpecialMesh5.Parent = Part4
  78. SpecialMesh5.MeshId = "http://www.roblox.com/asset/?id=1185246"
  79. SpecialMesh5.Scale = Vector3.new(1636.63672, 1636.63672, 0)
  80. SpecialMesh5.TextureId = "http://www.roblox.com/asset/?id=21315275"
  81. SpecialMesh5.VertexColor = Vector3.new(0, 0, 0)
  82. SpecialMesh5.MeshType = Enum.MeshType.FileMesh
  83. SpecialMesh5.Scale = Vector3.new(1636.63672, 1636.63672, 0)
  84. Script6.Name = "spin"
  85. Script6.Parent = Part4
  86. table.insert(cors,sandbox(Script6,function()
  87. spinning = script.Parent
  88.  
  89. while true do
  90. spinning.CFrame = spinning.CFrame * CFrame.fromEulerAnglesXYZ(0, math.rad(0), 0.2)
  91. wait()
  92. end
  93.  
  94. end))
  95. Script7.Parent = Part4
  96. table.insert(cors,sandbox(Script7,function()
  97. local hole = script.Parent
  98. local childList = {}
  99.  
  100. local massConstant = 5.8 -- Generally a good value
  101.  
  102. local mass = 32000 * massConstant
  103.  
  104. -- This is basically a function that finds all unanchored parts and adds them to childList.
  105. -- Note: This should only be run once for each object
  106. function checkObject(obj)
  107. if (obj ~= hole) and (obj.className == "Part") then
  108. if (obj.Anchored == false) then
  109. table.insert(childList, 1, obj)
  110. end
  111. elseif (obj.className == "Model") or (obj.className == "Hat") or (obj.className == "Tool") or (obj == workspace) then
  112. local child = obj:GetChildren()
  113. for x = 1, #child do
  114. checkObject(child[x])
  115. end
  116. obj.ChildAdded:connect(checkObject)
  117. end
  118. end
  119.  
  120. checkObject(workspace)
  121.  
  122. print("Black Hole script loaded.")
  123.  
  124. local n = 0
  125. while true do
  126. if n < #childList then
  127. n = n + 1
  128. if n % 800 == 0 then
  129. wait()
  130. end
  131. else
  132. n = 1
  133. wait()
  134. end
  135.  
  136. local child = childList[n]
  137. if (child ~= hole) and (child.className == "Part") and (child.Anchored == false) then
  138. local relPos = hole.Position - child.Position
  139. local motivator = child:FindFirstChild("BlackHole Influence")
  140. if relPos.magnitude * 240 * massConstant < mass then
  141. child:BreakJoints()
  142. if (relPos.magnitude * 320 * massConstant < mass) and (child.Size.z + hole.Size.x > relPos.magnitude * 2 - 4) then
  143. mass = mass + child:GetMass()
  144. child:Remove()
  145. table.remove(childList, n)
  146. n = n - 1 -- This is the reason I need a counter of my own design
  147. else
  148. child.CanCollide = false -- I Can assume that things won't escape the black hole.
  149. if motivator == nil then
  150. motivator = Instance.new("BodyPosition")
  151. motivator.Parent = child
  152. motivator.Name = "BlackHole Influence"
  153. end
  154. motivator.position = hole.Position
  155. motivator.maxForce = Vector3.new(1, 1, 1) * mass * child:GetMass() / (relPos.magnitude * massConstant)
  156. end
  157. elseif motivator ~= nil then
  158. motivator:Remove()
  159. end
  160. end
  161. end
  162. end))
  163. for i,v in pairs(mas:GetChildren()) do
  164. v.Parent = workspace
  165. pcall(function() v:MakeJoints() end)
  166. end
  167. mas:Destroy()
  168. for i,v in pairs(cors) do
  169. spawn(function()
  170. pcall(v)
  171. end)
  172. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement