-- [[ Rscripts Risk Notice ]] -- This script is not verified by rscripts.net. Deal with caution. -- -- Stay safe: -- • Never log in on unofficial Roblox sites or lookalike domains. -- • Real Roblox links use roblox.com (check the .com ending). -- • Treat fake Roblox login / "claim reward" pages as phishing. -- [[ End Rscripts Risk Notice ]] local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local Workspace = game:GetService("Workspace") local player = Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui", 10) if not playerGui then warn("[Race Pilot] PlayerGui не найден.") return end local registry if type(getgenv) == "function" then local ok, env = pcall(getgenv) if ok and type(env) == "table" then registry = env end end local registryKey = "__RaceTweenPilot" if registry then local previous = registry[registryKey] if type(previous) == "table" and type(previous.Stop) == "function" then pcall(previous.Stop) end else warn("[Race Pilot] getgenv недоступен. Перед повторным запуском закрой старый экземпляр крестиком.") end local state = { running = true, pilot = false, noclip = false, speed = 400, connections = {}, car = nil, seat = nil, seatToPivot = nil, clearance = nil, direction = nil, target = nil, lastPlan = 0, lastStatus = 0, collisionOriginal = {}, } local function connect(signal, callback) local connection = signal:Connect(callback) table.insert(state.connections, connection) return connection end local gui = Instance.new("ScreenGui") gui.Name = "RaceTweenPilot" gui.ResetOnSpawn = false gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling gui.Parent = playerGui local frame = Instance.new("Frame") frame.Name = "Window" frame.Size = UDim2.fromOffset(340, 250) frame.Position = UDim2.new(0.5, -170, 0.35, 0) frame.BackgroundColor3 = Color3.fromRGB(0, 0, 0) frame.BorderColor3 = Color3.fromRGB(120, 120, 120) frame.BorderSizePixel = 1 frame.Parent = gui local titleBar = Instance.new("Frame") titleBar.Size = UDim2.new(1, 0, 0, 38) titleBar.BackgroundColor3 = Color3.fromRGB(0, 0, 0) titleBar.BorderSizePixel = 0 titleBar.Parent = frame local title = Instance.new("TextLabel") title.Size = UDim2.new(1, -48, 1, 0) title.Position = UDim2.fromOffset(12, 0) title.BackgroundTransparency = 1 title.Text = "RACE TWEEN PILOT" title.TextColor3 = Color3.fromRGB(255, 255, 255) title.Font = Enum.Font.Code title.TextSize = 17 title.TextXAlignment = Enum.TextXAlignment.Left title.Parent = titleBar local close = Instance.new("TextButton") close.Size = UDim2.fromOffset(34, 30) close.Position = UDim2.new(1, -38, 0, 4) close.BackgroundColor3 = Color3.fromRGB(0, 0, 0) close.BorderColor3 = Color3.fromRGB(120, 120, 120) close.Text = "X" close.TextColor3 = Color3.fromRGB(255, 255, 255) close.Font = Enum.Font.Code close.TextSize = 18 close.Parent = titleBar local function makeButton(y, text) local button = Instance.new("TextButton") button.Size = UDim2.new(1, -24, 0, 34) button.Position = UDim2.fromOffset(12, y) button.BackgroundColor3 = Color3.fromRGB(0, 0, 0) button.BorderColor3 = Color3.fromRGB(120, 120, 120) button.BorderSizePixel = 1 button.Text = text button.TextColor3 = Color3.fromRGB(255, 255, 255) button.Font = Enum.Font.Code button.TextSize = 15 button.Parent = frame return button end local pilotButton = makeButton(45, "АВТОПИЛОТ: ВЫКЛ") local noclipButton = makeButton(86, "НОУКЛИП: ВЫКЛ") local speedLabel = Instance.new("TextLabel") speedLabel.Size = UDim2.fromOffset(165, 30) speedLabel.Position = UDim2.fromOffset(12, 128) speedLabel.BackgroundTransparency = 1 speedLabel.Text = "СКОРОСТЬ, studs/с:" speedLabel.TextColor3 = Color3.fromRGB(255, 255, 255) speedLabel.Font = Enum.Font.Code speedLabel.TextSize = 14 speedLabel.TextXAlignment = Enum.TextXAlignment.Left speedLabel.Parent = frame local speedBox = Instance.new("TextBox") speedBox.Size = UDim2.fromOffset(85, 30) speedBox.Position = UDim2.new(1, -97, 0, 128) speedBox.BackgroundColor3 = Color3.fromRGB(0, 0, 0) speedBox.BorderColor3 = Color3.fromRGB(120, 120, 120) speedBox.TextColor3 = Color3.fromRGB(255, 255, 255) speedBox.Font = Enum.Font.Code speedBox.TextSize = 15 speedBox.Text = "400" speedBox.ClearTextOnFocus = false speedBox.Parent = frame local status = Instance.new("TextLabel") status.Size = UDim2.new(1, -24, 0, 42) status.Position = UDim2.fromOffset(12, 166) status.BackgroundTransparency = 1 status.Text = "Сядь в машину лицом по трассе." status.TextColor3 = Color3.fromRGB(220, 220, 220) status.Font = Enum.Font.Code status.TextSize = 13 status.TextWrapped = true status.TextXAlignment = Enum.TextXAlignment.Left status.Parent = frame local hint = Instance.new("TextLabel") hint.Size = UDim2.new(1, -24, 0, 25) hint.Position = UDim2.fromOffset(12, 215) hint.BackgroundTransparency = 1 hint.Text = "F7: АВТО F8: NOCLIP RightShift: МЕНЮ" hint.TextColor3 = Color3.fromRGB(190, 190, 190) hint.Font = Enum.Font.Code hint.TextSize = 11 hint.TextXAlignment = Enum.TextXAlignment.Left hint.Parent = frame local function setStatus(text) status.Text = text end local function restoreCollisions() for part, original in pairs(state.collisionOriginal) do local ok, err = pcall(function() if part.Parent and part.CanCollide == false then part.CanCollide = original end end) if not ok then warn("[Race Pilot] Не удалось восстановить столкновения:", err) end end table.clear(state.collisionOriginal) end local function setNoclip(enabled) state.noclip = enabled if enabled then noclipButton.Text = "НОУКЛИП: ВКЛ" setStatus("Ноуклип включён для машины и персонажа.") else restoreCollisions() noclipButton.Text = "НОУКЛИП: ВЫКЛ" setStatus("Ноуклип выключен.") end end local function resetPilotData() state.car = nil state.seat = nil state.seatToPivot = nil state.clearance = nil state.direction = nil state.target = nil state.lastPlan = 0 end local function setPilot(enabled, reason) state.pilot = enabled if enabled then resetPilotData() pilotButton.Text = "АВТОПИЛОТ: ВКЛ" setStatus("Поиск машины и дороги...") else resetPilotData() pilotButton.Text = "АВТОПИЛОТ: ВЫКЛ" setStatus(reason or "Автопилот выключен.") end end local function stop() if not state.running then return end state.running = false state.pilot = false state.noclip = false restoreCollisions() for _, connection in ipairs(state.connections) do connection:Disconnect() end table.clear(state.connections) resetPilotData() gui:Destroy() if registry and registry[registryKey] == state then registry[registryKey] = nil end end state.Stop = stop if registry then registry[registryKey] = state end connect(close.MouseButton1Click, stop) connect(pilotButton.MouseButton1Click, function() setPilot(not state.pilot) end) connect(noclipButton.MouseButton1Click, function() setNoclip(not state.noclip) end) connect(speedBox.FocusLost, function() local value = tonumber(speedBox.Text) if value and value == value then state.speed = math.clamp(value, 20, 400) end speedBox.Text = tostring(math.floor(state.speed + 0.5)) end) connect(UserInputService.InputBegan, function(input, processed) if processed or UserInputService:GetFocusedTextBox() then return end if input.KeyCode == Enum.KeyCode.F7 then setPilot(not state.pilot) elseif input.KeyCode == Enum.KeyCode.F8 then setNoclip(not state.noclip) elseif input.KeyCode == Enum.KeyCode.RightShift then frame.Visible = not frame.Visible end end) local dragging = false local dragInput local dragStart local startPosition connect(titleBar.InputBegan, function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragInput = input dragStart = input.Position startPosition = frame.Position end end) connect(UserInputService.InputChanged, function(input) if not dragging or not dragInput then return end local mouseMove = input.UserInputType == Enum.UserInputType.MouseMovement and dragInput.UserInputType == Enum.UserInputType.MouseButton1 local touchMove = input == dragInput and input.UserInputType == Enum.UserInputType.Touch if mouseMove or touchMove then local delta = input.Position - dragStart frame.Position = UDim2.new( startPosition.X.Scale, startPosition.X.Offset + delta.X, startPosition.Y.Scale, startPosition.Y.Offset + delta.Y ) end end) connect(UserInputService.InputEnded, function(input) if input == dragInput then dragging = false dragInput = nil end end) local function getSeatAndCar() local character = player.Character local humanoid = character and character:FindFirstChildOfClass("Humanoid") if not humanoid or humanoid.Health <= 0 then return nil, nil, character end local seat = humanoid.SeatPart if not seat then return nil, nil, character end local car = seat:FindFirstAncestorOfClass("Model") if not car then return nil, nil, character end return seat, car, character end local function applyNoclip(container) if not container then return end for _, object in ipairs(container:GetDescendants()) do if object:IsA("BasePart") then if state.collisionOriginal[object] == nil then state.collisionOriginal[object] = object.CanCollide end if object.CanCollide then object.CanCollide = false end end end end local function findTrack(part) local current = part while current and current ~= Workspace do if string.sub(current.Name, 1, 10) == "RaceTrack_" then return current end current = current.Parent end return nil end local function isRoad(part) return part and part:IsA("BasePart") and part.Name == "Road" and findTrack(part) ~= nil end local function roadAt(position, car, character) local excluded = {car} if character then table.insert(excluded, character) end local params = RaycastParams.new() params.FilterType = Enum.RaycastFilterType.Exclude params.IgnoreWater = true params.FilterDescendantsInstances = excluded local origin = position + Vector3.new(0, 25, 0) -- Пропускаем отдельные объекты над дорогой, но ограничиваем число лучей. for _ = 1, 6 do params.FilterDescendantsInstances = excluded local hit = Workspace:Raycast(origin, Vector3.new(0, -80, 0), params) if not hit then return nil end if isRoad(hit.Instance) and hit.Normal.Y > 0.5 then return hit end table.insert(excluded, hit.Instance) end return nil end local function flatUnit(vector) local flat = Vector3.new(vector.X, 0, vector.Z) if flat.Magnitude < 0.01 then return nil end return flat.Unit end local function rotateFlat(direction, angle) local c = math.cos(angle) local s = math.sin(angle) return Vector3.new( direction.X * c - direction.Z * s, 0, direction.X * s + direction.Z * c ) end local function findTarget(seat, car, character, direction) local position = seat.Position local candidates = {} local lookAhead = math.clamp(state.speed * 0.12, 18, 45) local offsets = {0, -8, 8, -16, 16} local angles = {0, -15, 15, -30, 30, -45, 45, -65, 65} for _, degrees in ipairs(angles) do local dir = rotateFlat(direction, math.rad(degrees)) local right = Vector3.new(-dir.Z, 0, dir.X) for _, offset in ipairs(offsets) do local probe = position + dir * lookAhead + right * offset local hit = roadAt(probe, car, character) if hit then local delta = hit.Position - position local flatDelta = Vector3.new(delta.X, 0, delta.Z) local progress = flatDelta:Dot(direction) if progress > 4 then table.insert(candidates, { hit = hit, score = progress - math.abs(offset) * 0.2 - math.abs(degrees) * 0.15, direction = dir, }) end end end end table.sort(candidates, function(a, b) return a.score > b.score end) local best = candidates[1] if not best then return nil end local point = best.hit.Position local right = Vector3.new(-best.direction.Z, 0, best.direction.X) -- Оцениваем ширину покрытия по лучам слева и справа. local leftEdge = 0 local rightEdge = 0 for distance = 4, 32, 4 do if roadAt(point - right * distance, car, character) then leftEdge = distance else break end end for distance = 4, 32, 4 do if roadAt(point + right * distance, car, character) then rightEdge = distance else break end end local centerOffset = (rightEdge - leftEdge) * 0.5 local centeredPoint = point + right * centerOffset local centeredHit = roadAt(centeredPoint, car, character) return centeredHit or best.hit end local function setupPilot(seat, car, character) local hit = roadAt(seat.Position, car, character) if not hit then return false, "Дорога под машиной не найдена." end local direction = flatUnit(seat.CFrame.LookVector) if not direction then return false, "Не удалось определить направление машины." end state.seat = seat state.car = car state.direction = direction state.clearance = math.clamp( (seat.Position - hit.Position):Dot(hit.Normal), 1, 10 ) state.seatToPivot = seat.CFrame:ToObjectSpace(car:GetPivot()) state.target = nil state.lastPlan = 0 return true end connect(player.CharacterAdded, function() if state.pilot then setPilot(false, "Респавн: сядь в машину и включи снова.") end if state.noclip then setNoclip(false) end end) connect(RunService.Heartbeat, function(dt) if not state.running then return end local seat, car, character = getSeatAndCar() if state.noclip then if not seat or not car then setNoclip(false) setStatus("Ноуклип выключен: машина не найдена.") else local ok, err = pcall(function() applyNoclip(car) applyNoclip(character) end) if not ok then setNoclip(false) warn("[Race Pilot] Ошибка ноуклипа:", err) setStatus("Ошибка ноуклипа; подробности в консоли.") end end end if not state.pilot then return end if not seat or not car then setPilot(false, "Сядь за руль гоночной машины.") return end if state.seat and (state.seat ~= seat or state.car ~= car) then setPilot(false, "Машина сменилась. Включи автопилот снова.") return end local ok, err = pcall(function() if not state.seat then local setupOk, reason = setupPilot(seat, car, character) if not setupOk then setPilot(false, reason) return end end local now = os.clock() if not state.target or now - state.lastPlan >= 0.15 then state.lastPlan = now local hit = findTarget(seat, car, character, state.direction) if not hit then setPilot(false, "Дорога впереди не найдена — остановлено.") return end state.target = hit.Position + hit.Normal * state.clearance end local delta = state.target - seat.Position local horizontal = flatUnit(delta) if not horizontal then state.target = nil return end local step = math.min(state.speed * math.min(dt, 0.1), delta.Magnitude, 12) local nextPosition = seat.Position + delta.Unit * step local ground = roadAt(nextPosition, car, character) if not ground then setPilot(false, "Дорога под следующим шагом не найдена.") return end local normal = ground.Normal local tangent = horizontal - normal * horizontal:Dot(normal) if tangent.Magnitude < 0.01 then setPilot(false, "Не удалось определить направление трассы.") return end tangent = tangent.Unit state.direction = flatUnit(tangent) or state.direction local targetPosition = ground.Position + normal * state.clearance local targetSeat = CFrame.lookAt( targetPosition, targetPosition + tangent, normal ) car:PivotTo(targetSeat * state.seatToPivot) if (state.target - targetPosition).Magnitude < 5 then state.target = nil end if now - state.lastStatus >= 0.3 then state.lastStatus = now setStatus("Еду по Road | цель: " .. math.floor(state.speed) .. " studs/с") end end) if not ok then warn("[Race Pilot] Ошибка:", err) setPilot(false, "Ошибка автопилота — подробности в консоли.") end end) print("[Race Pilot] Загружен. F7 — авто, F8 — ноуклип, RightShift — меню.")