Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Model0 = Instance.new("Model")
- Part1 = Instance.new("Part")
- SpecialMesh2 = Instance.new("SpecialMesh")
- Script3 = Instance.new("Script")
- Part4 = Instance.new("Part")
- SpecialMesh5 = Instance.new("SpecialMesh")
- Script6 = Instance.new("Script")
- Script7 = Instance.new("Script")
- Model0.Name = "BlackHole"
- Model0.Parent = mas
- Part1.Name = "H"
- Part1.Parent = Model0
- Part1.Transparency = 0.0099999997764826
- Part1.Rotation = Vector3.new(0, 0, -69.2600021)
- Part1.Anchored = true
- Part1.CanCollide = false
- Part1.FormFactor = Enum.FormFactor.Symmetric
- Part1.Size = Vector3.new(1131.22009, 1229.58716, 49.1834869)
- Part1.CFrame = CFrame.new(31.235281, -367.953583, -83.5919495, 0.354115248, 0.935203671, 0, -0.935203671, 0.354115248, 0, 0, 0, 1)
- Part1.BottomSurface = Enum.SurfaceType.Smooth
- Part1.TopSurface = Enum.SurfaceType.Smooth
- Part1.Position = Vector3.new(31.235281, -367.953583, -83.5919495)
- Part1.Orientation = Vector3.new(0, 0, -69.2600021)
- SpecialMesh2.Name = "planar1"
- SpecialMesh2.Parent = Part1
- SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=1185246"
- SpecialMesh2.Scale = Vector3.new(9836.69434, 9836.69434, 0)
- SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=21315275"
- SpecialMesh2.VertexColor = Vector3.new(0, 0, 0)
- SpecialMesh2.MeshType = Enum.MeshType.FileMesh
- SpecialMesh2.Scale = Vector3.new(9836.69434, 9836.69434, 0)
- Script3.Name = "spin"
- Script3.Parent = Part1
- table.insert(cors,sandbox(Script3,function()
- spinning = script.Parent
- while true do
- spinning.CFrame = spinning.CFrame * CFrame.fromEulerAnglesXYZ(0, math.rad(0), 0.2)
- wait()
- end
- end))
- Part4.Name = "H"
- Part4.Parent = Model0
- Part4.Transparency = 1
- Part4.Rotation = Vector3.new(-180, 0, 21.4099998)
- Part4.Anchored = true
- Part4.CanCollide = false
- Part4.FormFactor = Enum.FormFactor.Symmetric
- Part4.Size = Vector3.new(1131.22009, 1229.58716, 49.1834869)
- Part4.CFrame = CFrame.new(31.320837, -368.080811, -34.4080696, 0.931013227, -0.365007758, 0, -0.365007788, -0.931013346, 0, 0, 0, -1)
- Part4.BottomSurface = Enum.SurfaceType.Smooth
- Part4.TopSurface = Enum.SurfaceType.Smooth
- Part4.Position = Vector3.new(31.320837, -368.080811, -34.4080696)
- Part4.Orientation = Vector3.new(0, 180, -158.589996)
- SpecialMesh5.Name = "planar1"
- SpecialMesh5.Parent = Part4
- SpecialMesh5.MeshId = "http://www.roblox.com/asset/?id=1185246"
- SpecialMesh5.Scale = Vector3.new(9836.69434, 9836.69434, 0)
- SpecialMesh5.TextureId = "http://www.roblox.com/asset/?id=21315275"
- SpecialMesh5.VertexColor = Vector3.new(0, 0, 0)
- SpecialMesh5.MeshType = Enum.MeshType.FileMesh
- SpecialMesh5.Scale = Vector3.new(9836.69434, 9836.69434, 0)
- Script6.Name = "spin"
- Script6.Parent = Part4
- table.insert(cors,sandbox(Script6,function()
- spinning = script.Parent
- while true do
- spinning.CFrame = spinning.CFrame * CFrame.fromEulerAnglesXYZ(0, math.rad(0), 0.2)
- wait()
- end
- end))
- Script7.Parent = Part4
- table.insert(cors,sandbox(Script7,function()
- local hole = script.Parent
- local childList = {}
- local massConstant = 5.8 -- Generally a good value
- local mass = 32000 * massConstant
- -- This is basically a function that finds all unanchored parts and adds them to childList.
- -- Note: This should only be run once for each object
- function checkObject(obj)
- if (obj ~= hole) and (obj.className == "Part") then
- if (obj.Anchored == false) then
- table.insert(childList, 1, obj)
- end
- elseif (obj.className == "Model") or (obj.className == "Hat") or (obj.className == "Tool") or (obj == workspace) then
- local child = obj:GetChildren()
- for x = 1, #child do
- checkObject(child[x])
- end
- obj.ChildAdded:connect(checkObject)
- end
- end
- checkObject(workspace)
- print("Black Hole script loaded.")
- local n = 0
- while true do
- if n < #childList then
- n = n + 1
- if n % 800 == 0 then
- wait()
- end
- else
- n = 1
- wait()
- end
- local child = childList[n]
- if (child ~= hole) and (child.className == "Part") and (child.Anchored == false) then
- local relPos = hole.Position - child.Position
- local motivator = child:FindFirstChild("BlackHole Influence")
- if relPos.magnitude * 240 * massConstant < mass then
- child:BreakJoints()
- if (relPos.magnitude * 320 * massConstant < mass) and (child.Size.z + hole.Size.x > relPos.magnitude * 2 - 4) then
- mass = mass + child:GetMass()
- child:Remove()
- table.remove(childList, n)
- n = n - 1 -- This is the reason I need a counter of my own design
- else
- child.CanCollide = false -- I Can assume that things won't escape the black hole.
- if motivator == nil then
- motivator = Instance.new("BodyPosition")
- motivator.Parent = child
- motivator.Name = "BlackHole Influence"
- end
- motivator.position = hole.Position
- motivator.maxForce = Vector3.new(1, 1, 1) * mass * child:GetMass() / (relPos.magnitude * massConstant)
- end
- elseif motivator ~= nil then
- motivator:Remove()
- end
- end
- end
- end))
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = workspace
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement