local plr = game:GetService("Players").LocalPlayer local repstorage = game:GetService("ReplicatedStorage") getgenv().Evade = getgenv().Evade or {} local cfg = getgenv().Evade cfg.topSpeed = 60 cfg.maxSpeed = 90 local funcs = require(repstorage:WaitForChild("Objects").Game.Character.Client.Movement.MoveFunction.Functions) local strafeCut, backCut = 0.65, 0.4 local accel, turn = 80, 10 local gain, decay, swingRef = 25, 8, 5 local ease, drag, brake = 70, 18, 200 local scale = 90 local function turnTo(cur, goal, max) if goal.Magnitude < 1e-4 then return cur end if cur.Magnitude < 1e-4 then return goal.Unit end local a, b = cur.Unit, goal.Unit local ang = math.acos(math.clamp(a.X * b.X + a.Y * b.Y, -1, 1)) if ang <= max then return b end local side = (a.X * b.Y - a.Y * b.X) >= 0 and 1 or -1 local c, s = math.cos(max * side), math.sin(max * side) return Vector2.new(a.X * c - a.Y * s, a.X * s + a.Y * c) end if not getgenv().Evd then getgenv().Evd = true local spd, extra = 0, 0 local dir = Vector2.new(0, -1) local lastY = 0 local function step(dt, data, mover, state, grounded) if not (mover and mover.BaseMover) then return mover, state end local look = data:Get("LookCFrame") local input = data:Get("MoveDirection") or Vector3.zero local world = look and look:VectorToWorldSpace(input) or input local wish = Vector2.new(world.X, world.Z) local moving = wish.Magnitude > 0.05 local aim = wish if not moving and look then aim = Vector2.new(look.LookVector.X, look.LookVector.Z) end dir = turnTo(dir, aim, turn * dt) local face = look and Vector2.new(look.LookVector.X, look.LookVector.Z) or dir local align = face.Magnitude > 0 and dir:Dot(face.Unit) or 1 local cut = align >= 0 and strafeCut + (1 - strafeCut) * align or strafeCut + (strafeCut - backCut) * align local y = look and math.atan2(look.LookVector.X, look.LookVector.Z) or lastY local dy = (y - lastY + math.pi) % (2 * math.pi) - math.pi lastY = y local swing = dt > 0 and math.clamp(math.abs(dy) / dt / swingRef, 0, 1) or 0 extra = math.clamp(extra + ((moving and swing * gain or 0) - decay) * dt, 0, cfg.maxSpeed - cfg.topSpeed) local target = moving and (cfg.topSpeed + extra) * cut or 0 if spd < target then spd = math.min(target, spd + accel * dt) else spd = math.max(target, spd - (moving and ease or (grounded and brake or drag)) * dt) end local v = dir * (spd * scale) mover.BaseMover.PlaneVelocity = v if state and state.Velocity then state.Velocity = Vector3.new(v.X, state.Velocity.Y, v.Y) end return mover, state end local run, air = funcs.Run, funcs.Air funcs.Run = function(dt, m, data, char, stats) local mover, state = run(dt, m, data, char, stats) return step(dt, data, mover, state, true) end funcs.Air = function(dt, m, data, char, stats) local mover, state = air(dt, m, data, char, stats) return step(dt, data, mover, state, false) end end