local Players = game:GetService("Players") local RunService = game:GetService("RunService") local Lighting = game:GetService("Lighting") local Workspace = game:GetService("Workspace") local player = Players.LocalPlayer local camera = Workspace.CurrentCamera ------------------------------------------------ -- 🌌 SETTINGS ------------------------------------------------ local SPACE_Y = 805 local DEFAULT_GRAVITY = Workspace.Gravity ------------------------------------------------ -- 🌍 EARTH SYSTEM (isolated at bottom logic) ------------------------------------------------ local EarthSystem = {} EarthSystem.Model = nil EarthSystem.Rotation = 0 EarthSystem.Speed = math.rad(360) / 240 EarthSystem.Center = Vector3.new(0, 0, 0) EarthSystem.Tilt = math.rad(23.44) EarthSystem.Scale = 500000 EarthSystem.ModelId = 11453648192 EarthSystem.BaseCFrame = CFrame.new(EarthSystem.Center) * CFrame.Angles(EarthSystem.Tilt, 0, 0) function EarthSystem:Load() local model = game:GetObjects("rbxassetid://" .. self.ModelId)[1] model.Parent = workspace for _, obj in ipairs(model:GetDescendants()) do if obj:IsA("BasePart") then obj.Size *= self.Scale obj.Anchored = true obj.CanCollide = false elseif obj:IsA("SpecialMesh") then obj.Scale *= self.Scale end end model.PrimaryPart = model:FindFirstChildWhichIsA("BasePart", true) self.Model = model end function EarthSystem:Update(dt) if not self.Model then return end self.Rotation += self.Speed * dt self.Model:PivotTo(self.BaseCFrame * CFrame.Angles(0, self.Rotation, 0)) end function EarthSystem:IsInside(pos) if not self.Model then return false end local cf = self.Model:GetPivot() local size = self.Model:GetExtentsSize() local localPos = cf:PointToObjectSpace(pos) return math.abs(localPos.X) <= size.X / 2 and math.abs(localPos.Y) <= size.Y / 2 and math.abs(localPos.Z) <= size.Z / 2 end EarthSystem:Load() ------------------------------------------------ -- 🌫 VISIBILITY SYSTEM ------------------------------------------------ local function setWorldVisible(visible) local char = player.Character for _, obj in ipairs(workspace:GetDescendants()) do if obj:IsA("BasePart") and (not EarthSystem.Model or not EarthSystem.Model:IsAncestorOf(obj)) and obj ~= workspace.Terrain and (not char or not obj:IsDescendantOf(char)) then obj.LocalTransparencyModifier = visible and 0 or 1 end end end ------------------------------------------------ -- 🔁 MAIN LOOP ------------------------------------------------ local lastState RunService.RenderStepped:Connect(function(dt) -- 🌍 Earth rotation EarthSystem:Update(dt) -- 👤 Player local char = player.Character local hrp = char and char:FindFirstChild("HumanoidRootPart") if not hrp then return end local inSpace = hrp.Position.Y >= SPACE_Y local insideEarth = (not inSpace) and EarthSystem:IsInside(hrp.Position) local state = inSpace and "space" or (insideEarth and "inside") or "normal" if state ~= lastState then lastState = state if state == "space" then setWorldVisible(false) Workspace.Gravity = DEFAULT_GRAVITY Lighting.ClockTime = 0 Lighting.Brightness = 0 elseif state == "inside" then setWorldVisible(true) Workspace.Gravity = DEFAULT_GRAVITY Lighting.ClockTime = 14 Lighting.Brightness = 2 else setWorldVisible(true) Workspace.Gravity = 0 Lighting.ClockTime = 0 Lighting.Brightness = 0 end end end)