getgenv().SoundSpaceCache = getgenv().SoundSpaceCache or {} if SoundSpaceCache.tasks then for _, t in next, SoundSpaceCache.tasks do pcall(task.cancel, t) pcall(function() t:Disconnect() end) end end SoundSpaceCache.tasks = {} local RunService = game:GetService('RunService') local ReplicatedFirst = game:GetService('ReplicatedFirst') local UserInputService = game:GetService('UserInputService') local Camera = workspace.CurrentCamera local SpaceManager = require(ReplicatedFirst.Modules.SpaceManager) while not SpaceManager._current or not SpaceManager._current.Loaded do task.wait(0.5) end local strength = 10 local min = 0.5 local AimAssist = setmetatable({}, { __index = function(self, k) if SpaceManager._current and SpaceManager._current.Run then local v = SpaceManager._current.Run[k] if v ~= nil then return v end end return rawget(self, k) end }) do function AimAssist:init() self.tasks = SoundSpaceCache.tasks self._mouseX = Camera.ViewportSize.X / 2 self._mouseY = Camera.ViewportSize.Y / 2 self.tasks['Aim'] = RunService.RenderStepped:Connect(function(dt) self:Update(dt) end) end function AimAssist:GetNearest() local spawned = self._spawned if not spawned then return nil end local noteWidth = (self._mods and self._mods.HardMode) and 1 or 1.75 local halfW = noteWidth / 2 local best, bestX = nil, math.huge for cube in next, spawned do local cx = cube.CFrame.X + halfW if cx >= 0 and cx < bestX then bestX = cx best = cube end end return best end function AimAssist:Update(dt) if not self.Running or self._isPaused or self._spectating or self._awaitEnd then return end local cube = self:GetNearest() if not cube then return end local notePos, onScreen = Camera:WorldToScreenPoint(Vector3.new(0, cube.CFrame.Y, cube.CFrame.Z)) if not onScreen then return end local targetX = notePos.X local targetY = notePos.Y local dx = targetX - self._mouseX local dy = targetY - self._mouseY local dist = math.sqrt(dx * dx + dy * dy) if dist < min then return end local sens = UserInputService.MouseDeltaSensitivity local alpha = math.min(1, dt * strength) local moveX = dx * alpha / sens local moveY = dy * alpha / sens self._mouseX = self._mouseX + moveX * sens self._mouseY = self._mouseY + moveY * sens mousemoverel(moveX, moveY) end AimAssist:init() end