-- /simple auto-drive\ -- svc refs local rs = game:GetService("RunService") local ps = game:GetService("Players") local ws = game:GetService("Workspace") local lp = ps.LocalPlayer local rsh = game:GetService("ReplicatedStorage"):WaitForChild("Shared") local pcl = lp:WaitForChild("PlayerScripts"):WaitForChild("Client") local rq = function(m) if not m then return end local ok, res = pcall(require, m) return ok and res or nil end local rul = rsh:WaitForChild("Rules") local cfg = rsh:WaitForChild("Config") local rpw = rq(rul:WaitForChild("RoadPath")) local wcd = rq(cfg:WaitForChild("World")) local cct = rq(pcl:WaitForChild("CarController")) local cin = rq(pcl:WaitForChild("CarInput")) local rcn = rq(pcl:WaitForChild("RunClient")) if not (rpw and wcd and cct and cin) then return end local ok, rd = pcall(rpw.build, wcd) if not ok or type(rd) ~= "table" then return end local rln = rd.length or 1e9 -- tunables local S = { mx = 300, -- max speed cap gr = 380, -- grip / accel gravity dc = 85, -- decel factor rh = 3, -- ride height on = true, -- loop alive flag st = 0 -- steer output } -- helpers local function gch() local st = cct.state local ch = st and st.chassis if ch and ch.Parent and not ch.Anchored then return ch end local hm = lp.Character and lp.Character:FindFirstChildOfClass("Humanoid") local sp = hm and hm.SeatPart if sp and sp.Name == "DriverSeat" and sp.Parent then ch = sp.Parent:FindFirstChild("Chassis") if ch and ch.Parent and not ch.Anchored then return ch end end end local function dcp(t) local o = {} for k, v in pairs(t) do o[k] = type(v) == "table" and dcp(v) or v end return o end local function tun(t) local ty = t.Tyres if ty then ty.LateralGrip = 2.4 ty.LongitudinalGrip = 2.2 ty.PeakSlip = 16 ty.DriftWindow = 70 end local sr = t.Steering if sr then sr.MaxAngle = 55 sr.MinAngle = 12 sr.Rate = 9 sr.ReturnRate = 13 end local eg = t.Engine if eg then eg.Force = 3 eg.Redline = 9000 eg.Limiter = 9300 end local gr = t.Gears if gr then gr.ShiftTime = 0.08 gr.MinGearTime = 0.15 gr.UpRpm = 8600 gr.DownRpm = 4200 end if t.Brakes then t.Brakes.Force = 90 end local da = t.DriftAssist if da then if da.Initiate then da.Initiate.Speed = 999 end da.EnterSlip = 90 if da.Surfaces and da.Surfaces.Ice and da.Surfaces.Ice.Initiate then da.Surfaces.Ice.Initiate.Speed = 999 end end if t.Bounce then t.Bounce.LaunchFromSpeed = 999 end if t.Tumble then t.Tumble.MinDeltaV = 999 t.Tumble.MinSpeed = 999 end return t end -- tune watcher task.spawn(function() local cT while S.on do task.wait(0.25) pcall(function() local rg = cct.rig and cct.rig() if rg and rg.Tune and rg.Tune ~= cT then cT = tun(dcp(rg.Tune)) rg.Tune = cT end end) end end) -- hook input local oinp = cin.Read local ninp = function(...) local t = oinp(...) if type(t) ~= "table" or select(1, ...) == true then return t end t.Throttle = 1 t.Brake = 0 t.Handbrake = false t.Steer = S.st return t end if not pcall(function() cin.Read = ninp end) then return end -- setup local hzn = { 16, 36, 66, 104, 152, 216 } local rps = RaycastParams.new() rps.FilterType = Enum.RaycastFilterType.Exclude rps.RespectCanCollide = true rps.IgnoreWater = true local sw, sdo, stq = 0, 0, { ps = 0, pt = 0, stk = 0, nud = 0, pr = 0, fin = false } -- main tick rs.Heartbeat:Connect(function() local ch = gch() if not ch then return end pcall(function() local cf = ch.CFrame local pos = cf.Position local s = rpw.project(rd, pos.X, pos.Z) if not s or s ~= s then return end if s < 3 then stq.fin = false end pcall(rpw.ride, rd, rd.route, pos.X, pos.Z) local sc = math.clamp(s, 0, rln - 1) local cv = ch.AssemblyLinearVelocity local v = cv.Magnitude local vm = S.mx for _, d in ipairs(hzn) do local _, _, _, ax, az = rpw.pointAt(rd, sc + d) local _, _, _, bx, bz = rpw.pointAt(rd, sc + d + 20) local th = math.acos(math.clamp(ax * bx + az * bz, - 1, 1)) if th > 0.02 then local va = math.sqrt(S.gr * 20 / th + 2 * S.dc * d) if va < vm then vm = va end end end local qx, qy, qz = rpw.pointAt(rd, sc) local la = math.clamp(v * 0.4 + 14, 18, 95) local tx, _, tz = rpw.pointAt(rd, math.min(sc + la, rln - 0.5)) local dx, dz = tx - pos.X, tz - pos.Z local dl = math.sqrt(dx * dx + dz * dz) if dl < 2 then local _, _, _, fx, fz = rpw.pointAt(rd, sc) dx, dz, dl = fx, fz, 1 end dx, dz = dx / dl, dz / dl local dir = Vector3.new(dx, 0, dz) local ray = (dir + Vector3.new(0, 0.1, 0)).Unit local rgt = Vector3.new(- dz, 0, dx) local lv = cf.LookVector local fl = Vector3.new(lv.X, 0, lv.Z) fl = fl.Magnitude > 0.01 and fl.Unit or dir local ang = math.atan2(fl:Cross(dir).Y, fl:Dot(dir)) S.st = math.clamp(- ang * 1.2, - 1, 1) sw = sw + (math.clamp(ang * 3.2, - 4.5, 4.5) - sw) * 0.35 ch.AssemblyAngularVelocity = Vector3.new(0, sw, 0) local sd = 0 local flt = { ch.Parent } if ws.CurrentCamera then flt[# flt + 1] = ws.CurrentCamera end for _, pp in ipairs(ps:GetPlayers()) do if pp.Character then flt[# flt + 1] = pp.Character end end rps.FilterDescendantsInstances = flt local org = pos + Vector3.new(0, 1.2, 0) local fd = v * 0.5 + 12 if ws:Raycast(org, ray * fd, rps) then local a1 = ws:Raycast(org, (dir + rgt * 0.6).Unit * fd, rps) local a2 = ws:Raycast(org, (dir - rgt * 0.6).Unit * fd, rps) if a1 and (not a2 or a2.Distance > a1.Distance) then sd = - 1 elseif a2 then sd = 1 end end sdo = sdo + (sd * 14 - sdo) * 0.18 local fw = math.clamp(cv:Dot(dir) + (vm - cv:Dot(dir)) * 0.6, - 10, vm) local lt = math.clamp(cv:Dot(rgt) * 0.15 + sdo, - 25, 25) local dy = qy + S.rh - pos.Y local vy = cv.Y + (math.clamp(dy * 9, - 70, 70) - cv.Y) * 0.6 ch.AssemblyLinearVelocity = dir * fw + rgt * lt + Vector3.new(0, vy, 0) if math.abs(cf.RightVector.Y) > 0.35 or math.abs(lv.Y) > 0.55 or math.abs(dy) > 45 or math.abs(ang) > 2.4 or math.sqrt((qx - pos.X) ^ 2 + (qz - pos.Z) ^ 2) > 40 then local np = pos + dir * 4 + Vector3.new(0, qy + S.rh - pos.Y, 0) ch.CFrame = CFrame.lookAt(np, np + dir) ch.AssemblyAngularVelocity = Vector3.zero sw, sdo = 0, 0 end local nw = os.clock() if sc > stq.ps + 1 then stq.ps, stq.stk, stq.nud = sc, 0, 0 elseif v < 12 then stq.stk = stq.stk + 1 if stq.stk > 55 and nw - stq.pt > 1.2 then stq.pt, stq.nud = nw, stq.nud + 1 if stq.nud > 5 then stq.nud = 0 pcall(function() cct.reset() end) else local np = Vector3.new(qx, qy + S.rh + 1, qz) + dir * 12 ch.CFrame = CFrame.lookAt(np, np + dir) ch.AssemblyLinearVelocity = dir * 25 sw, sdo = 0, 0 end end end if not stq.fin and rcn and rcn.state() == "Finished" then stq.fin = true end end) end)