Advertisement
1m1m0

Blackhole v5.0 RESCRIPTED

Mar 16th, 2025 (edited)
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 25.26 KB | Source Code | 0 0
  1. -- [ Blackhole Alpha Release v5.0 RESCRIPTED ]
  2. -- Integrated constraint-based gravity for even smoother simulations
  3.  
  4. local blackHole = script.Parent         -- Reference
  5.  
  6. -------------------------------------------------------
  7. -- | CONTROL PANEL | -- (See Documentation for info) --
  8. -------------------------------------------------------
  9.  
  10. -- {GRAVITY} --                         {G}
  11. local gravity = 100                     -- Base gravitational constant
  12. local alignSpeed = 5                    -- How quickly the AlignPosition responds
  13. local forceCap = 4000                   -- Maximum force (constraint cap) Note that math.huge means infinity (for realistic gravity, higher cap = higher accuracy)
  14. local range = 500                       -- Effective range of gravitational pull
  15. local centerOfMassBased = false         -- Toggle force application at center of mass
  16. local realisticGravity = false          -- Toggle inverse square law (closer objects have greater gravity)
  17. local realGravDamping = 32              -- Factor to control gravity when `realisticGravity` is on (higher = faster)
  18. local microGravity = false              -- Disable workspace gravity
  19. local gravityEngine = "linear1"         -- Choose the gravity engine ("linear1", "linear2", "line", "vector", "align", "bodyvelocity", "bodyforce")
  20. local gravitationMode = "universal"     -- "selective" (only tagged objects) vs "universal" (everything)
  21. local attractionTag = "attractable"     -- Tag required if `gravitationMode` is selective
  22.  
  23. -- {ABSORPTION} --                      {A}
  24. local absorption = true                 -- Absorb objects on contact
  25. local growth = true                     -- Blackhole grows when absorbing objects
  26. local growthDamping = 0.01              -- Damping factor for growth
  27. local fading = true                     -- Fade objects out before absorption
  28. local fadeDuration = 1                  -- Time (in seconds) to fade out
  29. local anchoring = true                  -- Anchor objects when fading
  30. local colorShift = true                 -- Change color of objects as they fade
  31. local color = Color3.fromRGB(255, 0, 0) -- Target color for shifting (red by default)
  32. local rocheFactor = 2                   -- Multiple of blackHole’s size at which non-gravity joints are removed (0 disables)
  33. local merging = true                    -- Allow blackholes to merge
  34.  
  35. -- {SPECIAL EFFECTS} --                 {S}
  36. local lensing = true                    -- Gravitational lensing effect
  37. local lensingFactor = 2.5               -- Multiplier for the lensing effect’s radius
  38. local lensingStrength = 100             -- Strength of lensing effect (don’t set too high)
  39. local cameraDistortion = true           -- Camera FOV distortion when within range
  40. local distortThreshold = 1              -- Percentage of range for FOV distortion threshold
  41. local blackHoleSound = true             -- Toggle blackhole sound
  42. local distortSound = false              -- Toggle pitch distortion when blackholes are near
  43. local toggleGlint = true                -- Turn the Glint effect on or off
  44. local glintSizeMultiplier = 0.1         -- Base multiplier for the glint effect
  45.  
  46. -- {DEBUGGING} --
  47. local logging = true                    -- Toggle logging output (note that not all errors are taken into account, just most)
  48. local logSettings = true                -- Log detailed settings
  49.  
  50. ------------------------
  51. -- | CORE MECHANICS | --
  52. ------------------------
  53.  
  54. local camera = workspace.Camera     -- For camera distortion effects
  55. local defaultFOV = camera.FieldOfView
  56.  
  57. -- Track previous size for proportional updates
  58. local previousSize = blackHole.Size.X
  59.  
  60. -- Table to keep track of active constraints and attachments
  61. local activeGravity = {}
  62. local blackHoleAttachment = Instance.new("Attachment")
  63. blackHoleAttachment.Parent = blackHole
  64.  
  65. -- Convert string inputs to lowercase for consistency
  66. gravityEngine = gravityEngine:lower()
  67. gravitationMode = gravitationMode:lower()
  68.  
  69. -- Helper: Clamp distance to a minimum value to avoid division by zero
  70. local function clampDistance(dist)
  71.     local minDist = 1
  72.     return math.max(dist, minDist)
  73. end
  74.  
  75. -- The master formula for modern gravities *insert angel chorus*
  76. local masterFormula = function(object)
  77.     local distance = (blackHole.Position - object.Position).Magnitude
  78.     local effDist = clampDistance(distance)
  79.     if realGravDamping < 0 then
  80.         realGravDamping = 1 -- Prevent division by 0
  81.     end
  82.     -- Compute the gravitational force using Newtonian physics with conversion
  83.     ------------------------------------------------------------------------------------------------------------
  84.     local computedForce = (gravity * blackHole:GetMass() * object:GetMass()) / ((effDist / realGravDamping) ^ 2) -- ONLY APPLIES TO REALISTIC GRAVITY!
  85.     ------------------------------------------------------------------------------------------------------------
  86.     -- Clamp the force to forceCap so that it never exceeds this maximum
  87.     return math.min(computedForce, forceCap)
  88. end
  89.  
  90. -- The legacy master formula for bodyforce and bodyvelocity
  91. local legacyMasterFormula = function(object)
  92.     local direction = blackHole.Position - object.Position
  93.     local dist = clampDistance(direction.Magnitude)
  94.     --------------------------------------------------------------------------
  95.     local forceMag = (gravity * blackHole.Size.X * object.Size.X) / (dist ^ 2)
  96.     --------------------------------------------------------------------------
  97.     -- For BodyVelocity, if the object is too close to the blackHole, we nullify the force.
  98.     if dist < blackHole.Size.X / 2 then
  99.         forceMag = 0
  100.     end
  101.     return {
  102.         distance = dist,
  103.         direction = direction.Unit,
  104.         force = forceMag,
  105.     }
  106. end
  107.  
  108. local whiteHoleMode = false -- secret event hehe
  109.  
  110. -- Function to apply gravity to an object using the selected gravity engine
  111. local function ApplyGravity(object)
  112.     if activeGravity[object] then return end
  113.  
  114.     local objectAttachment = Instance.new("Attachment")
  115.     objectAttachment.Parent = object
  116.    
  117.     local distance = (blackHole.Position - object.Position).Magnitude
  118.     local effDist = clampDistance(distance)
  119.  
  120.     if gravityEngine == "linear1" or gravityEngine == "1.1" or gravityEngine == "linear2" or gravityEngine == "1.2" then
  121.         local linearVel = Instance.new("LinearVelocity")
  122.         linearVel.Attachment0 = objectAttachment
  123.         linearVel.RelativeTo = Enum.ActuatorRelativeTo.World
  124.         linearVel.MaxForce = forceCap
  125.  
  126.         -- Whitehole mode oh my goodness gracious
  127.         if gravity < 0 then
  128.             whiteHoleMode = true
  129.         end
  130.  
  131.         if gravityEngine == "linear1" or gravityEngine == "1.1" then
  132.             linearVel.VelocityConstraintMode = Enum.VelocityConstraintMode.Line
  133.             local lineDir = (blackHole.Position - object.Position).Unit
  134.             linearVel.LineDirection = lineDir
  135.             linearVel.LineVelocity = gravity
  136.  
  137.         elseif gravityEngine == "linear2" or gravityEngine == "1.2" then
  138.             linearVel.VelocityConstraintMode = Enum.VelocityConstraintMode.Vector
  139.             local dist = (blackHole.Position - object.Position).Unit
  140.             if realisticGravity then
  141.                 linearVel.VectorVelocity = dist * masterFormula(object)
  142.             else
  143.                 local newVelocityMag = (distance > 0) and (gravity / distance) or 0
  144.                 linearVel.VectorVelocity = (blackHole.Position - object.Position).Unit * newVelocityMag * gravity
  145.             end
  146.         end
  147.        
  148.         linearVel.Parent = object
  149.         activeGravity[object] = { constraint = linearVel, attachment = objectAttachment }
  150.  
  151.         -- LineForce-based gravity
  152.     elseif gravityEngine == "line" or gravityEngine == "2" then
  153.         local lineForce = Instance.new("LineForce")
  154.         lineForce.Attachment0 = objectAttachment
  155.         lineForce.Attachment1 = blackHoleAttachment
  156.         lineForce.ApplyAtCenterOfMass = centerOfMassBased
  157.         lineForce.MaxForce = forceCap
  158.  
  159.         if gravity < 0 then
  160.             -- Swap attachments to reverse the force direction
  161.             lineForce.MaxForce = -forceCap
  162.             whiteHoleMode = true
  163.         end
  164.  
  165.         if realisticGravity then
  166.             lineForce.Magnitude = masterFormula(object)
  167.         else
  168.             lineForce.Magnitude = gravity
  169.         end
  170.         lineForce.Parent = object
  171.         activeGravity[object] = { constraint = lineForce, attachment = objectAttachment }
  172.  
  173.         -- VectorForce-based gravity
  174.     elseif gravityEngine == "vector" or gravityEngine == "3" then
  175.         local vectorForce = Instance.new("VectorForce")
  176.         vectorForce.Attachment0 = objectAttachment
  177.         vectorForce.RelativeTo = Enum.ActuatorRelativeTo.Attachment1
  178.  
  179.         -- Whitehole mode
  180.         if gravity < 0 then
  181.             whiteHoleMode = true
  182.         end
  183.        
  184.         if realisticGravity then
  185.             local direction = (blackHole.Position - object.Position).Unit
  186.             vectorForce.Force = direction * masterFormula(object)
  187.         else
  188.             vectorForce.Force = (blackHole.Position - object.Position).Unit * gravity
  189.         end
  190.         vectorForce.ApplyAtCenterOfMass = centerOfMassBased
  191.         vectorForce.Parent = object
  192.         activeGravity[object] = { constraint = vectorForce, attachment = objectAttachment }
  193.  
  194.         -- AlignPosition-based gravity
  195.     elseif gravityEngine == "align" or gravityEngine == "4" then
  196.         local alignPos = Instance.new("AlignPosition")
  197.         alignPos.Attachment0 = objectAttachment
  198.         alignPos.Attachment1 = blackHoleAttachment
  199.         alignPos.MaxForce = forceCap
  200.         alignPos.MaxVelocity = forceCap
  201.         alignPos.Responsiveness = alignSpeed
  202.         alignPos.ApplyAtCenterOfMass = centerOfMassBased
  203.         alignPos.Parent = object
  204.         activeGravity[object] = { constraint = alignPos, attachment = objectAttachment }
  205.  
  206.         -- Legacy BodyVelocity-based gravity (does not support models)
  207.         -- The maths are untouched and are exactly identical to v4.0+
  208.     elseif gravityEngine == "bodyvelocity" or gravityEngine == "speed" or gravityEngine == "5" then
  209.         local legacy = legacyMasterFormula(object)
  210.         if legacy.force == 0 then
  211.             return
  212.         end
  213.         object.Velocity = object.Velocity + (legacy.direction * legacy.force)
  214.  
  215.         -- Whitehole mode
  216.         if gravity < 0 then
  217.             whiteHoleMode = true
  218.         end
  219.  
  220.         -- Legacy BodyForce-based gravity (supports models)
  221.     elseif gravityEngine == "bodyforce" or gravityEngine == "force" or gravityEngine == "6" then
  222.         local legacy = legacyMasterFormula(object)
  223.         local force = legacy.direction * legacy.force
  224.         local bodyForce = object:FindFirstChild("BlackHoleBodyForce", true)
  225.         if not bodyForce then
  226.             bodyForce = Instance.new("BodyForce")
  227.             bodyForce.Name = "BlackHoleBodyForce"
  228.             bodyForce.Force = force
  229.             bodyForce.Parent = object
  230.         else
  231.             bodyForce.Force = force
  232.         end
  233.  
  234.         -- Whitehole mode
  235.         if gravity < 0 then
  236.             whiteHoleMode = true
  237.         end
  238.     end
  239. end
  240.  
  241. -- Remove gravity constraints from an object
  242. local function RemoveGravity(object)
  243.     local data = activeGravity[object]
  244.     if data then
  245.         data.constraint:Destroy()
  246.         data.attachment:Destroy()
  247.         activeGravity[object] = nil
  248.     end
  249. end
  250.  
  251. -- Function to grow the black hole when it absorbs an object
  252. local function GrowBlackHole(object)
  253.     if growth and object:IsA("BasePart") then
  254.         local avgSize = (object.Size.X + object.Size.Y + object.Size.Z) / 3
  255.         local growthFactor = (1 / avgSize) * growthDamping
  256.         blackHole.Size = blackHole.Size + Vector3.new(growthFactor, growthFactor, growthFactor)
  257.         range = range + growthFactor
  258.         gravity = gravity + growthFactor
  259.         if gravity < 0 then gravity = gravity - growthFactor end
  260.         blackHole:FindFirstChild("BlackholeSound", true).RollOffMinDistance = range
  261.     end
  262. end
  263.  
  264. -- Function to absorb (and remove) an object
  265. local function AbsorbObject(object)
  266.     if growth then
  267.         GrowBlackHole(object)
  268.     end
  269.     RemoveGravity(object)
  270.     object:Destroy()
  271. end
  272.  
  273. local CollectionService = game:GetService("CollectionService")
  274.  
  275. -- Event listener for absorption on contact
  276. if absorption then
  277.     blackHole.Touched:Connect(function(hit)
  278.         if hit:IsA("BasePart") and hit ~= blackHole then
  279.             -- Merging logic for blackholes
  280.             if merging and CollectionService:HasTag(hit, "Blackholev5") then
  281.                 local otherBlackHole = hit
  282.                 local currentSize = blackHole.Size.X
  283.                 local otherSize = otherBlackHole.Size.X
  284.                 if currentSize < otherSize then
  285.                     local newSize = otherSize + currentSize
  286.                     otherBlackHole.Size = Vector3.new(newSize, newSize, newSize)
  287.                     if otherBlackHole:FindFirstChild("FX") and otherBlackHole:FindFirstChild("BlackholeSound", true) then
  288.                         otherBlackHole:FindFirstChild("BlackholeSound", true).RollOffMaxDistance = otherBlackHole:FindFirstChild("BlackholeSound", true).RollOffMaxDistance + currentSize
  289.                     end
  290.                     blackHole:Destroy()
  291.                 elseif currentSize > otherSize then
  292.                     local newSize = currentSize + otherSize
  293.                     blackHole.Size = Vector3.new(newSize, newSize, newSize)
  294.                     if blackHole:FindFirstChild("FX") and blackHole:FindFirstChild("BlackholeSound", true) then
  295.                         otherBlackHole:FindFirstChild("BlackholeSound", true).RollOffMaxDistance = otherBlackHole:FindFirstChild("BlackholeSound", true).RollOffMaxDistance + otherSize
  296.                     end
  297.                     otherBlackHole:Destroy()
  298.                 else
  299.                     local newSize = currentSize * 2
  300.                     blackHole.Size = Vector3.new(newSize, newSize, newSize)
  301.                     if blackHole:FindFirstChild("FX") and blackHole:FindFirstChild("BlackholeSound", true) then
  302.                         otherBlackHole:FindFirstChild("BlackholeSound", true).RollOffMaxDistance = otherBlackHole:FindFirstChild("BlackholeSound", true).RollOffMaxDistance * 2
  303.                     end
  304.                     otherBlackHole:Destroy()
  305.                 end
  306.                 return
  307.             end
  308.  
  309.             -- Normal absorption for non-blackhole objects
  310.             if not hit.Anchored then
  311.                 if absorption then
  312.                     if fading then
  313.                         hit.Anchored = anchoring
  314.                         hit.CanCollide = false
  315.                         local startTransparency = hit.Transparency
  316.                         local initialColor = hit.Color
  317.                         local elapsed = 0
  318.                         local heartbeat = game:GetService("RunService").Heartbeat
  319.                         local connection
  320.                         connection = heartbeat:Connect(function(delta)
  321.                             elapsed = elapsed + delta
  322.                             local progress = math.min(elapsed / fadeDuration, 1)
  323.                             hit.Transparency = startTransparency + (1 - startTransparency) * progress
  324.                             if colorShift then
  325.                                 hit.Color = initialColor:Lerp(color, progress)
  326.                             end
  327.                             if progress >= 1 then
  328.                                 connection:Disconnect()
  329.                                 AbsorbObject(hit)
  330.                             end
  331.                         end)
  332.                     else
  333.                         AbsorbObject(hit)
  334.                     end
  335.                 end
  336.             end
  337.         end
  338.     end)
  339. end
  340.  
  341. if microGravity then
  342.     workspace.Gravity = 0
  343. end
  344.  
  345. -- Blackhole sound setup
  346. if blackHoleSound then
  347.     blackHole:FindFirstChild("BlackholeSound", true).Playing = true
  348.     blackHole:FindFirstChild("BlackholeSound", true).RollOffMaxDistance = range
  349. end
  350.  
  351. -- Glint VFX
  352. if toggleGlint then
  353.     blackHole:FindFirstChild("Glint", true).Enabled = true
  354. else
  355.     blackHole:FindFirstChild("Glint", true).Enabled = false
  356. end
  357.  
  358. -- Whitehole mode (if negative gravity/growth damping)
  359. if gravity < 0 and (gravityEngine == "linear1" or gravityEngine == "linear2" or gravityEngine == "1.1" or gravityEngine == "1.2" or gravityEngine == "line" or
  360.     gravityEngine == "2" or gravityEngine == "vector" or gravityEngine == "3" or gravityEngine == "bodyvelocity" or gravityEngine == "5" or gravityEngine == "bodyforce" or
  361.     gravityEngine == "6") then
  362.     local pureWhite = Color3.fromRGB(255, 255, 255)
  363.     blackHole:FindFirstChild("EventHorizon", true).FillColor = pureWhite
  364.     blackHole:FindFirstChild("EventHorizon", true).OutlineColor = pureWhite
  365.     blackHole:FindFirstChild("Glint", true).Color = ColorSequence.new(pureWhite)
  366.     blackHole:FindFirstChild("AccretionLight", true).Color = pureWhite
  367.     absorption = false
  368.     cameraDistortion = false
  369.     distortSound = false
  370.     whiteHoleMode = true
  371. end
  372.  
  373. -- Lensing effect setup
  374. if lensing then
  375.     local lensingPart = blackHole.Parent:FindFirstChild("Lensing", true)
  376.     if lensingPart then
  377.         if gravity < 0 then
  378.             lensingPart.Size = Vector3.new(0, 0, 0)
  379.         else
  380.             lensingPart.Size = blackHole.Size * lensingFactor
  381.             lensingPart.Transparency = lensingStrength
  382.             if lensingPart.Transparency < 15 then
  383.                 lensingPart.Lensing.Adornee = lensingPart.LensingAttachment
  384.             else
  385.                 lensingPart.Lensing.Adornee = lensingPart
  386.             end
  387.         end
  388.     end
  389. end
  390.  
  391. -- Main update loop
  392. game:GetService("RunService").Heartbeat:Connect(function()
  393.     -- Apply or remove gravity for parts in the workspace
  394.     for _, object in pairs(workspace:GetDescendants()) do
  395.         if object:IsA("BasePart") and object ~= blackHole and not object.Anchored then
  396.             local distance = (blackHole.Position - object.Position).Magnitude
  397.             local hasTag = CollectionService:HasTag(object, attractionTag)
  398.             if (gravitationMode == "selective" and hasTag and distance <= range) or (gravitationMode == "universal" and distance <= range and not CollectionService:HasTag(object, "BHcosmetic")) then
  399.                 ApplyGravity(object)
  400.             else
  401.                 RemoveGravity(object)
  402.             end
  403.         elseif activeGravity[object] then
  404.             RemoveGravity(object)
  405.         end
  406.     end
  407.  
  408.     -- Update active gravity constraints so they always point toward the black hole
  409.     for object, data in pairs(activeGravity) do
  410.         local distance = (blackHole.Position - object.Position).Magnitude  
  411.         if object:IsDescendantOf(workspace) and distance <= range then
  412.             local newDir = (blackHole.Position - object.Position).Unit
  413.             local effDist = clampDistance(distance)
  414.  
  415.             if data.constraint:IsA("VectorForce") then
  416.                 if realisticGravity then
  417.                     data.constraint.Force = newDir * masterFormula(object)
  418.                 else
  419.                     data.constraint.Force = newDir * gravity
  420.                 end
  421.             elseif data.constraint:IsA("LinearVelocity") then
  422.                 if data.constraint.VelocityConstraintMode == Enum.VelocityConstraintMode.Line then
  423.                     data.constraint.LineDirection = newDir
  424.                     if realisticGravity then
  425.                         data.constraint.LineVelocity = masterFormula(object)
  426.                     else
  427.                         data.constraint.LineVelocity = gravity
  428.                     end
  429.                 else
  430.                     local newVelocityMag = masterFormula(object) or 0
  431.                     data.constraint.VectorVelocity = newDir * newVelocityMag
  432.                 end
  433.             elseif data.constraint:IsA("LineForce") then
  434.                 if realisticGravity then
  435.                     data.constraint.Magnitude = masterFormula(object)
  436.                 else
  437.                     data.constraint.Magnitude = gravity
  438.                 end
  439.             elseif data.constraint:IsA("BodyVelocity") then
  440.                 local direction = blackHole.Position - object.Position
  441.                 local dist = clampDistance(direction.Magnitude)
  442.                 local forceMag = (gravity * blackHole.Size.X * object.Size.X) / (dist ^ 2)
  443.                 data.constraint.Velocity = object.Velocity + (direction.Unit * forceMag)
  444.             end
  445.         end
  446.     end
  447.  
  448.     -- Remove non-gravity constraints/joints from objects within the Roche radius
  449.     local rocheRadius = rocheFactor * blackHole.Size.X
  450.     if rocheRadius >= blackHole.Size.X then
  451.         for _, object in pairs(workspace:GetDescendants()) do
  452.             if object:IsA("BasePart") and object ~= blackHole then
  453.                 local dist = (blackHole.Position - object.Position).Magnitude
  454.                 if dist <= rocheRadius and not CollectionService:HasTag(object, "BHcosmetic") then
  455.                     for _, child in pairs(object:GetChildren()) do
  456.                         if child:IsA("Constraint") then
  457.                             if not (activeGravity[object] and activeGravity[object].constraint == child) then
  458.                                 local cname = child.ClassName
  459.                                 if cname ~= "LinearVelocity" and cname ~= "LineForce" and cname ~= "VectorForce" and cname ~= "AlignPosition" then
  460.                                     child:Destroy()
  461.                                 end
  462.                             end
  463.                         elseif child:IsA("JointInstance") then
  464.                             child:Destroy()
  465.                         end
  466.                     end
  467.                 end
  468.             end
  469.         end
  470.     end
  471.  
  472.     -- Camera distortion effect
  473.     if cameraDistortion and camera then
  474.         local camPos = camera.CFrame.Position
  475.         local distance = (blackHole.Position - camPos).Magnitude
  476.         local newFOV
  477.         if distance >= range then
  478.             newFOV = defaultFOV
  479.         elseif distance <= range * (distortThreshold / 100) then
  480.             newFOV = 120
  481.         else
  482.             local t = (range - distance) / (range - distortThreshold)
  483.             newFOV = defaultFOV + t * (120 - defaultFOV)
  484.         end
  485.         camera.FieldOfView = newFOV
  486.     end
  487.  
  488.     -- Sound pitch distortion effect for nearby blackholes
  489.     if distortSound then
  490.         local closestDist = math.huge
  491.         for _, bh in pairs(CollectionService:GetTagged("Blackholev5")) do
  492.             if bh ~= blackHole and bh:IsDescendantOf(workspace) then
  493.                 local d = (blackHole.Position - bh.Position).Magnitude
  494.                 if d < closestDist then
  495.                     closestDist = d
  496.                 end
  497.             end
  498.         end
  499.         local newPitch = 1
  500.         if closestDist < math.huge then
  501.             if closestDist <= range / 2 then
  502.                 newPitch = 1 - (closestDist / range)
  503.             else
  504.                 newPitch = 1
  505.             end
  506.         end
  507.         local pitchEffect = blackHole:FindFirstChild("BlackholeSound", true).PitchDistortion
  508.         if pitchEffect then
  509.             pitchEffect.Octave = newPitch
  510.         end
  511.     end
  512.  
  513.     -- Update Glint emitter, range, sound, and lensing based on blackHole size changes
  514.     local currentSize = blackHole.Size.X
  515.     if currentSize ~= previousSize then
  516.         local scaleFactor = currentSize / previousSize
  517.         local fx = blackHole:FindFirstChild("FX")
  518.         if fx then
  519.             local glint = fx:FindFirstChild("Glint")
  520.             if glint then
  521.                 local sizeSequence = glint.Size
  522.                 if sizeSequence and #sizeSequence.Keypoints > 0 then
  523.                     local baseSize = sizeSequence.Keypoints[1].Value
  524.                     local newSize = baseSize * scaleFactor
  525.                     glint.Size = NumberSequence.new(newSize)
  526.                 end
  527.             end
  528.            
  529.             if lensing then
  530.                 local lensingPart = blackHole.Parent:FindFirstChild("Lensing", true)
  531.                 if lensingPart then
  532.                     if gravity < 0 then
  533.                         lensingPart.Size = Vector3.new(0, 0, 0)
  534.                     else
  535.                         lensingPart.Size = blackHole.Size * lensingFactor
  536.                     end
  537.                 end
  538.             end
  539.         end
  540.         range = range * scaleFactor
  541.         blackHole:FindFirstChild("BlackholeSound", true).RollOffMaxDistance = range
  542.         previousSize = currentSize
  543.     end
  544. end)
  545.  
  546. -- Logging and error handling. Its all on me, dont worry
  547. if logging then
  548.     local gE = gravityEngine
  549.     local gM = gravitationMode
  550.     local aT = attractionTag
  551.     print("{-- | Blackhole v5 Alpha Logger | --}")
  552.     if gE == "linear1" or gE == "1.1" or gE == "linear2" or gE == "1.2" then
  553.         print("{BHv5: Running LinearVelocity gravity")
  554.     elseif gE == "line" or gE == "2" then
  555.         print("{BHv5: Running LineForce gravity")
  556.     elseif gE == "vector" or gE == "3" then
  557.         print("{BHv5: Running VectorForce gravity")
  558.     elseif gE == "align" or gE == "4" then
  559.         print("{BHv5: Running AlignPosition gravity")
  560.     elseif gE == "bodyvelocity" or gE == "speed" or gE == "5" then
  561.         print("{BHv5: Running LEGACY BodyVelocity gravity")
  562.         print("{   BodyVelocity is unstable but accurate. It does NOT support models!")
  563.         print("{   Consider this when running it")
  564.     elseif gE == "bodyforce" or gE == "force" or gE == "6" then
  565.         print("{BHv5: Running LEGACY BodyForce gravity")
  566.         print("{   BodyVelocity is stable but inaccurate. This supports models")
  567.         print("{   Consider this when running it.")
  568.     else
  569.         warn("{BHv5: Unrecognised gravity engine: '" .. tostring(gE) .. "'")
  570.         warn("{   Switching to default gravity")
  571.         gravityEngine = "1.1"
  572.     end
  573.     if gM == "universal" or gM == "selective" then
  574.         print("{BHv5: Set to " .. tostring(gM:upper()) .. " gravitation")
  575.     else
  576.         warn("{BHv5: Unrecognised mode: '" .. tostring(gM) .. "'")
  577.         warn("{   Setting to default gravitation mode")
  578.         gravitationMode = "universal"
  579.     end
  580.     print("{BHv5: Current attraction tag is '" .. tostring(aT) .. "'")
  581.     --if scriptConflict then warn("{BHv5: Blackhole assets modified, please revert changes or disable them to prevent conflicts") end
  582.     if logSettings then
  583.         print("{v5 Settings}")
  584.         print("{G  Current gravity is " .. tostring(gravity))
  585.         if whiteHoleMode == true then warn("{G  Blackhole has negative gravity! (whitehole mode)") blackHole.Parent:FindFirstChild("Lensing", true).Size = Vector3.new(0, 0, 0) end
  586.         if range < 0 then warn("{G  Range cannot be less than 0! Please enter a positive integer") else print("{G  Initial range is " .. tostring(range)) end
  587.         if gE == "align" or gE == "4" then
  588.             print("{G  Aligning speed is " .. tostring(alignSpeed))
  589.         end
  590.         if realisticGravity then print("{G  Realistic gravity is Enabled") else
  591.             print("{G  Realistic gravity is Disabled")
  592.         end
  593.         if realGravDamping < 0 then warn("{G  Realistic Gravity Damping cannot be less than zero! (set to 1)") end
  594.         if microGravity then print("{G  Workspace gravity is Disabled") else
  595.             print("{G  Workspace gravity is Enabled")
  596.         end
  597.         if absorption then print("{A  Absorption is Enabled") else
  598.             print("{A  Absorption is Disabled")
  599.         end
  600.         if growth then print("{A  The blackhole can grow with a damping of " .. tostring(growthDamping)) else
  601.             print("{A  The Blackhole cannot grow")
  602.         end
  603.         local sT = " seconds"
  604.         if fadeDuration == 1 then sT = " second" else sT = " seconds" end
  605.         if fading then
  606.             print("{A  Absorbed objects can fade out for " .. tostring(fadeDuration) .. sT)
  607.             if colorShift then print("{A  Objects shift in color when fading") else
  608.                 print("{A  Objects do not shift in color when fading")
  609.             end
  610.         else
  611.             print("{A  Absorbed objects do not fade out, therefore it cannot shift in color")
  612.         end
  613.         if anchoring then print("{A  Objects freeze when fading") else
  614.             print("{A  Objects do not freeze when fading")
  615.         end
  616.         print("{A  Fragmentation occurs at " .. tostring(rocheFactor) .. "x the blackhole's radius")
  617.         if merging then print("{A  Blackholes can merge") else
  618.             print("{A  Blackholes cannot merge")
  619.         end
  620.         if lensing then print("{S  Light is bent within " .. tostring(lensingFactor) .. "x the blackhole's radius with an intensity of " .. tostring(lensingStrength)) else
  621.             print("{S  Light is not bent around the blackhole")
  622.         end
  623.         if cameraDistortion then print("{S  FOV is alterable within range until " .. tostring(distortThreshold) .. "% of it (in editor/server mode)") else
  624.             print("{S  FOV is not altered within range")
  625.         end
  626.         if blackHoleSound then print("{S  The blackhole has sound") else
  627.             print("{S  The blackhole does not have sound")
  628.         end
  629.         if distortSound then print("{S  The blackhole sound is alterable within range [BETA]") else
  630.             print("{S  The blackhole sound is not alterable")
  631.         end
  632.         if toggleGlint then print("{S  Glint visual effects are Enabled") else print("{S  Glint visual effects are Disabled") end
  633.         print("{S  The blackhole's glint is proportional with a factor of " .. tostring(glintSizeMultiplier))
  634.     else
  635.         print("{BHv5: Settings report is disabled")
  636.     end
  637.     print("{Programming by zaragosa126}")
  638. end
Tags: Rescripted
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement