Advertisement
1m1m0
Apr 28th, 2024
4
0
Never
This is comment for paste Blackhole v5.0 Prototype
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- [ Blackhole 5.0 Source Code Prototype ] --
  2. -- DEV VERSION - Experimental use only
  3.  
  4. local hole = script.Parent
  5. local gravitationalConstant = 1000
  6. local updateInterval = 0
  7. local damping = 0.7
  8. local rangeFactor = 250
  9. local transparencySteps = {0.25, 0.5, 0.75}
  10. local dematerializeDuration = 0.01
  11. local partColor = BrickColor.new(0)
  12. local partMaterialTransform = Enum.Material.Neon
  13. local collision = true
  14. local fixedPosition = false
  15.  
  16. local lastUpdateTime = 0
  17.  
  18. local function ApplyGravity(object)
  19.  
  20.     local currentTime = tick()
  21.     if currentTime - lastUpdateTime < updateInterval then return end
  22.     lastUpdateTime = currentTime
  23.  
  24.     local direction = hole.Position - object.Position
  25.     local distance = direction.Magnitude
  26.     local distanceSquared = ((distance*6400) / (rangeFactor*65)) ^ 2
  27.  
  28.     local magnitude = gravitationalConstant / distanceSquared
  29.     local force = direction.Unit * magnitude * object:GetMass()
  30.  
  31.     local bodyForce = object:FindFirstChild("BlackHoleBodyForce")
  32.     if not bodyForce then
  33.         bodyForce = Instance.new("BodyForce")
  34.         bodyForce.Name = "BlackHoleBodyForce"
  35.         bodyForce.Force = Vector3.new(0, 0, 0)
  36.         bodyForce.Parent = object
  37.     end
  38.  
  39.     bodyForce.Force = (bodyForce.Force + force) * damping
  40. end
  41.  
  42. local function CheckAndApplyGravity(obj)
  43.    
  44.     if not obj:IsDescendantOf(game.Workspace) or not obj:IsA("BasePart") then
  45.         return
  46.     end
  47.  
  48.     if obj == hole or obj.Parent:IsA("Player") then
  49.         return
  50.     end
  51.  
  52.     if obj.Anchored then
  53.         return
  54.     end
  55.  
  56.     ApplyGravity(obj)
  57. end
  58.  
  59. game:GetService("RunService").Heartbeat:Connect(function()
  60.     for _, object in pairs(game.Workspace:GetDescendants()) do
  61.         CheckAndApplyGravity(object)
  62.     end
  63. end)
  64.  
  65.  
  66. function onTouched(part)
  67.    
  68.     part.BrickColor = partColor
  69.     part.Material = partMaterialTransform
  70.     part.CanCollide = collision
  71.     part.Anchored = fixedPosition
  72.    
  73.     for _, transparency in ipairs(transparencySteps) do
  74.         part.Transparency = transparency
  75.         wait(dematerializeDuration)
  76.     end
  77.  
  78.     part:Destroy()
  79. end
  80.  
  81. --[
  82. local connection = hole.Touched:Connect(onTouched)
  83. --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement