Advertisement
Gamerulexerul

Untitled

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