-- Ultra Instinct: Player + Unanchored Part Dodge -- Place in StarterPlayer > StarterPlayerScripts -- Use a LocalScript local Players = game:GetService("Players") local RunService = game:GetService("RunService") local player = Players.LocalPlayer local DODGE_DISTANCE = 5 local PART_DODGE_DISTANCE = 3 local TELEPORT_DISTANCE_MIN = 3 local TELEPORT_DISTANCE_MAX = 5 local DODGE_COOLDOWN = 0.35 local lastDodge = 0 local function findNearbyThreat(myRoot) -- Check nearby players for _, otherPlayer in ipairs(Players:GetPlayers()) do if otherPlayer ~= player then local character = otherPlayer.Character local root = character and character:FindFirstChild("HumanoidRootPart") local humanoid = character and character:FindFirstChildOfClass("Humanoid") if root and humanoid and humanoid.Health > 0 then if (root.Position - myRoot.Position).Magnitude <= DODGE_DISTANCE then return true end end end end -- Check nearby unanchored parts for _, part in ipairs(workspace:GetPartBoundsInRadius( myRoot.Position, PART_DODGE_DISTANCE )) do if part:IsA("BasePart") and not part.Anchored and not part:IsDescendantOf(player.Character) then -- Ignore parts belonging to player characters local model = part:FindFirstAncestorOfClass("Model") local isCharacter = model and Players:GetPlayerFromCharacter(model) if not isCharacter then return true end end end return false end local function randomDodge(character, myRoot) local angle = math.random() * math.pi * 2 local distance = math.random( TELEPORT_DISTANCE_MIN, TELEPORT_DISTANCE_MAX ) local offset = Vector3.new( math.cos(angle) * distance, 0, math.sin(angle) * distance ) local destination = myRoot.Position + offset -- Find the ground at the destination local rayParams = RaycastParams.new() rayParams.FilterType = Enum.RaycastFilterType.Exclude rayParams.FilterDescendantsInstances = {character} local result = workspace:Raycast( destination + Vector3.new(0, 12, 0), Vector3.new(0, -40, 0), rayParams ) if result then destination = Vector3.new( destination.X, result.Position.Y + 3, destination.Z ) else destination = Vector3.new( destination.X, myRoot.Position.Y, destination.Z ) end character:PivotTo( CFrame.new(destination) * myRoot.CFrame.Rotation ) end RunService.Heartbeat:Connect(function() if os.clock() - lastDodge < DODGE_COOLDOWN then return end local character = player.Character if not character then return end local myRoot = character:FindFirstChild("HumanoidRootPart") local humanoid = character:FindFirstChildOfClass("Humanoid") if not myRoot or not humanoid or humanoid.Health <= 0 then return end if findNearbyThreat(myRoot) then lastDodge = os.clock() randomDodge(character, myRoot) end end)